App crashes when coming back from another activity with landscape orientation On Android 8.1
See original GitHub issue- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
[skip envinfo]
Description
I have a Reat Native v0.44 Main Activity A which is configured as portrait
orientation while destination Activity B is landscape
, when A startActivityForResult
to B and B finished ok with result to pass to A, the App crashed.
If using following code to set orientation in B, the problem could be solved temporarily:
boolean isOverAndroid8 = Build.VERSION.SDK_INT > Build.VERSION_CODES.N;
if (isOverAndroid8) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
below is styles.xml
:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
</resources>
So, i think it has something related between Reat Native and Android 8.1.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:37 (2 by maintainers)
Top Results From Across the Web
App Crashes in landscape mode - android - Stack Overflow
Resources$NotFoundException. This exception is thrown by the resource APIs when a requested resource can not be found.
Read more >Request: remove new restriction of Android 8.1 : "Only ...
Workaround: In the android manifest, declare the translucent activity with the following orientation.: screenOrientation="behind" The modal screen's orientation ...
Read more >app crash when screen orientation changes???
In my AndroidManifest.xml the android:screenOrientation="landscape" was in a second activity tag, below an activity tag that also included
Read more >Detect and diagnose crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >[Solved] Android 8 and Traslucent and Portrait BUGS - B4X
I found this in my log file, when compiling an app with translucent theme: java.lang.RuntimeException: Unable to start activity ComponentInfo{at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi friends, after a long time I managed to fix this error. You need to add android: launchMode = “singleTask” in AndroidManifest.xml
what would it be like this
<activity android:name=“.MainActivity” android:label=“@string/app_name” android:configChanges=“keyboard|keyboardHidden|orientation|screenSize” android:windowSoftInputMode=“adjustPan” android:launchMode=“singleTask” // ++++++++++++++
I had a problem due to react-native-splash-screen library
still happening on 0.60.5