Fixed
Status Update
Comments
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #2
Can you rise priority please?
It's a real stopper to use in not helloworld apps.
It must be joke, define it as "An issue that should be addressed eventually. Such an issue is not relevant to core organizational functions or the work of other teams, or else it relates only to the attractiveness or pleasantness of the system."
Why use compose in production, if this base things resolved for years?
It's a real stopper to use in not helloworld apps.
It must be joke, define it as "An issue that should be addressed eventually. Such an issue is not relevant to core organizational functions or the work of other teams, or else it relates only to the attractiveness or pleasantness of the system."
Why use compose in production, if this base things resolved for years?
Description
Devices/Android versions reproduced on: Pixel 2 XL emulator, SDK 28
When using the @ContentView on my Activity alongside the Navigation lib, if you background the app, terminate it using Android Studio, and then re-open it from recents you receive an IllegalArgumentException and something along the lines of the following as a stacktrace:
2019-03-04 22:49:11.338 16838-16838/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mikescamell.fragmentcrashtest, PID: 16838
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mikescamell.fragmentcrashtest/com.mikescamell.fragmentcrashtest.MainActivity}: java.lang.IllegalArgumentException: Fragment NavHostFragment{504d1a8 (b3220214-5197-4fdf-9204-7069fb9e014a) id=0x7f08008d} is not an active fragment of FragmentManager FragmentManager{adea4c1 in HostCallbacks{5452466}}
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
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)
Caused by: java.lang.IllegalArgumentException: Fragment NavHostFragment{504d1a8 (b3220214-5197-4fdf-9204-7069fb9e014a) id=0x7f08008d} is not an active fragment of FragmentManager FragmentManager{adea4c1 in HostCallbacks{5452466}}
at androidx.fragment.app.FragmentManagerImpl.setPrimaryNavigationFragment(FragmentManagerImpl.java:2757)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:674)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2069)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1859)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1814)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1721)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2623)
at androidx.fragment.app.FragmentManagerImpl.dispatchCreate(FragmentManagerImpl.java:2573)
at androidx.fragment.app.FragmentController.dispatchCreate(FragmentController.java:236)
at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:304)
at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:85)
at com.mikescamell.fragmentcrashtest.MainActivity.onCreate(MainActivity.kt:17)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
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)
I've attached a project that can replicate this.
Reproduction steps:
1. Open app
2. Background the app
3. Terminate the application using Android Studio
4. Reopen the app using recents
I've been able to fix this by simply going back to using the setContentView function after the super call in onCreate.