question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when closing the app while the rn activity is not on top

See original GitHub issue

When an app opens a new activity and then is backgrounded it crashes because getCurrentActivity returns another activity.

In my case it happens when using facebook sign in and then backgrounding the app.

EDIT: Can’t seem to repro consistently but I think my theory about getCurrentActivity is still valid.

IllegalStateException
In order to use RNScreen components your app's activity need to extend ReactFragmentActivity or ReactCompatActivity
com.swmansion.rnscreens.ScreenContainer in <init> at line 44
com.swmansion.rnscreens.ScreenContainerViewManager in createViewInstance at line 21
com.swmansion.rnscreens.ScreenContainerViewManager in createViewInstance at line 9
com.facebook.react.uimanager.ViewManager in createView at line 44
com.facebook.react.uimanager.NativeViewHierarchyManager in createView at line 260
com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation in execute at line 200
com.facebook.react.uimanager.UIViewOperationQueue$1 in run at line 908
com.facebook.react.uimanager.UIViewOperationQueue in flushPendingBatches at line 1021
com.facebook.react.uimanager.UIViewOperationQueue in access$2500 at line 46
com.facebook.react.uimanager.UIViewOperationQueue$2 in runGuarded at line 979
com.facebook.react.bridge.GuardedRunnable in run at line 24
android.os.Handler in handleCallback at line 739
android.os.Handler in dispatchMessage at line 95
android.os.Looper in loop at line 145
android.app.ActivityThread in main at line 5942
java.lang.reflect.Method in invoke
java.lang.reflect.Method in invoke at line 372
com.android.internal.os.ZygoteInit$MethodAndArgsCaller in run at line 1399
com.android.internal.os.ZygoteInit in main at line 1194

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
javiercrcommented, Jan 8, 2019

@kmagiera

I still cannot reproduce this problem but as it’s been mentioned earlier the problem might be that ReactContext.getCurrentActivity does not return the correct react activity but some other activity that has covered the current one.

We’re using Intercom Android SK through react-native-intercom. We use it as our in-app support chat. Is it possible Intercom’s messenger is the activity which is covering the current one as you described?

Anyways, we’ll give a shot to alpha.20, thank you very much!

0reactions
WoLewickicommented, Apr 3, 2020

Ok, so I am closing it. Looks like it was https://github.com/software-mansion/react-native-screens/commit/c0b73545ffba5eb3310451c368ec6cbcac429a59 which @kmagiera linked since no more activity on the issue since then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do my apps keep crashing on Android, How to fix it
To do this, go to Settings -> Apps and select the app that keeps crashing. Tap on the app's name and then tap...
Read more >
React Native app crashes without any error log - Stack Overflow
Open Android Studio · Open Logcat · Click on "Edit Filter Configuration" in the right top of the logcat screen · Fill in...
Read more >
[Android] - Release Application crashes immediately after ...
Description Application crashes immediately after having upgraded to 0.70.0 with newArchEnabled=true. If i keep newArchEnabled=false the app ...
Read more >
How to Fix Crashing Apps on an iPhone or Android?
10 Solutions to fix App Crashes and Keep Apps Running: For Apple iPhone, ... Then you'll have to slide the app you want...
Read more >
App crashing immediately on start up after upgrading to iOS12.
Running fine in simulator but crashes in device. No crash logs recorded. ... Tried "Eare All Content and Settings" but it does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found