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.

App crashes when coming back from another activity with landscape orientation On Android 8.1

See original GitHub issue

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:open
  • Created 5 years ago
  • Reactions:3
  • Comments:37 (2 by maintainers)

github_iconTop GitHub Comments

18reactions
dimlksin2commented, Apr 21, 2020

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

10reactions
seavancommented, Feb 18, 2020

still happening on 0.60.5

Read more comments on GitHub >

github_iconTop 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 >

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