React-native: Android crash at onHostPause method

Created on 30 Nov 2018  Â·  10Comments  Â·  Source: facebook/react-native

Environment

react native version:0.56 targetSdkVersion: 22, compileSdkVersion:27,buildToolsVersion:27.0.3 android devices: android 8.0 , 8.1 and 9.0

Description

I get the crash information from the fabric ,I find two problem , the first infromation is:
Fatal Exception: java.lang.AssertionError: Pausing an activity that is not the current activity, this is incorrect! Current activity: MainActivity Paused activity: MainActivity
at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:500)
at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:99)
at com.facebook.react.ReactActivity.onPause(ReactActivity.java:58)
at android.app.Activity.performPause(Activity.java:7228)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1409)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:3947)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3924)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3898)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3869)
at android.app.ActivityThread.-wrap15(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1625)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:6633)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
and the most of devices is android 8.0 and 8.1
the second problem is :
Fatal Exception: java.lang.AssertionError
at com.facebook.infer.annotation.Assertions.assertNotNull(Assertions.java:28)
at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:499)
at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:99)
at com.facebook.react.ReactActivity.onPause(ReactActivity.java:58)
at android.app.Activity.performPause(Activity.java:7403)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1466)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:4064)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:4029)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3978)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6806)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
and the device is android 9.0
the two problem I find the source code :
@ThreadConfined(UI)
public void onHostPause(Activity activity) {
Assertions.assertNotNull(mCurrentActivity);
Assertions.assertCondition(
activity == mCurrentActivity,
"Pausing an activity that is not the current activity, this is incorrect! " +
"Current activity: " + mCurrentActivity.getClass().getSimpleName() + " " +
"Paused activity: " + activity.getClass().getSimpleName());
onHostPause();
}

so I don't know what happened, but I think it be related to above android 8.0 devices, I hope the crash is solved as soon as possible ,thanks !
10_35_11__11_30_2018
10_35_49__11_30_2018

Android Ran Commands Locked

Most helpful comment

i met the same question,maybe this sould be reopen

All 10 comments

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write [skip envinfo] under Environment to let us know.

@react-native-bot hello ,this problem is appeared in android phone that is above 8.0 , especially android 8.1 devices, and npm version is 5.6.0 , node version v8.11.3, android gradle 'com.android.tools.build:gradle:3.1.3' , build gradle is compileSdkVersion = 27 , buildToolsVersion = "27.0.3" , minSdkVersion = 16 , targetSdkVersion = 22 , react native version is 0.56.0, react version is 16.4.1, do you need other information?

@react-native-bot I provide the environment ! do you need other info?

I am closing this issue because it does not contain the necessary environment info, and there has been no followup in a while.

If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here.

any updates on this issue? i am getting same error as well
Screen Shot 2019-03-20 at 10 15 07 AM

phone_model: Mi A2 Lite
android_version: 9

java.lang.AssertionError: Pausing an activity that is not the current activity, this is incorrect! Current activity: MainActivity Paused activity: MainActivity
at com.facebook.infer.annotation.Assertions.assertCondition(Assertions.java:72)
at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:500)
at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:96)
at com.facebook.react.ReactActivity.onPause(ReactActivity.java:58)
at android.app.Activity.performPause(Activity.java:7329)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1466)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:4024)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3989)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3941)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1811)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6694)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Is there a solution to this problem?

i met the same question,maybe this sould be reopen

Please reopen this issue, I meet the same problem on Samsung Note 8

Same problem here:
androidApiLevel: 28,
reactNative: 0.59.10
Phone: HUAWEI P20 Pro (CLT-L09)

Assertions.java:28com.facebook.infer.annotation.Assertions.assertNotNull ReactInstanceManager.java:510com.facebook.react.ReactInstanceManager.onHostPause ReactActivityDelegate.java:94com.facebook.react.ReactActivityDelegate.onPause ReactActivity.java:58com.facebook.react.ReactActivity.onPause Activity.java:7663android.app.Activity.performPause

Was this page helpful?
0 / 5 - 0 ratings

Related issues

axelg12 picture axelg12  Â·  3Comments

jlongster picture jlongster  Â·  3Comments

anchetaWern picture anchetaWern  Â·  3Comments

WG-Com picture WG-Com  Â·  3Comments

DreySkee picture DreySkee  Â·  3Comments