[Crash]: RuntimeException after onboarding
czlucius opened this issue · comments
Steps to reproduce
- Clear data
- Open the app in portrait
- In the onboarding, rotate the screen several times
- Rotate to landscape
- Complete the onboarding
Expected behaviour
App opens without issue
Actual behaviour
App crashes
Device name
Samsung Galaxy S20 FE 5G
Android version/API Level
Android 12
App version
Built from source
Device/crash logs
FATAL EXCEPTION: main
Process: com.czlucius.scan.debug, PID: 24287
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.czlucius.scan.debug/com.czlucius.scan.ui.MainActivity}: android.view.InflateException: Binary XML file line #26 in com.czlucius.scan.debug:layout/activity_main: Binary XML file line #26 in com.czlucius.scan.debug:layout/activity_main: Error inflating class fragment
at [android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4037)](http://android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4037))
at [android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4203)](http://android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4203))
at [android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6340)](http://android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6340))
at [android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6205)](http://android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6205))
at [android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)](http://android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71))
at [android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)](http://android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45))
at [android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)](http://android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135))
at [android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)](http://android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95))
at [android.app.ActivityThread$H.handleMessage(ActivityThread.java:2440)](http://android.app.ActivityThread$H.handleMessage(ActivityThread.java:2440))
at [android.os.Handler.dispatchMessage(Handler.java:106)](http://android.os.Handler.dispatchMessage(Handler.java:106))
at [android.os.Looper.loopOnce(Looper.java:226)](http://android.os.Looper.loopOnce(Looper.java:226))
at [android.os.Looper.loop(Looper.java:313)](http://android.os.Looper.loop(Looper.java:313))
at [android.app.ActivityThread.main(ActivityThread.java:8641)](http://android.app.ActivityThread.main(ActivityThread.java:8641))
at java.lang.reflect.Method.invoke(Native Method)
at [com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)](http://com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567))
at [com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)](http://com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133))
Caused by: android.view.InflateException: Binary XML file line #26 in com.czlucius.scan.debug:layout/activity_main: Binary XML file line #26 in com.czlucius.scan.debug:layout/activity_main: Error inflating class fragment
Caused by: android.view.InflateException: Binary XML file line #26 in com.czlucius.scan.debug:layout/activity_main: Error inflating class fragment
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getHeight()' on a null object reference
at [com.czlucius.scan.ui.ScannerFragment.setMargins(ScannerFragment.java:421)](http://com.czlucius.scan.ui.ScannerFragment.setMargins(ScannerFragment.java:421))
at [com.czlucius.scan.ui.ScannerFragment.permissionDeniedPermanently(ScannerFragment.java:415)](http://com.czlucius.scan.ui.ScannerFragment.permissionDeniedPermanently(ScannerFragment.java:415))
at [com.czlucius.scan.ui.ScannerFragment.onRequestPermissionsResult(ScannerFragment.java:294)](http://com.czlucius.scan.ui.ScannerFragment.onRequestPermissionsResult(ScannerFragment.java:294))
at [androidx.fragment.app.FragmentManager$11.onActivityResult(FragmentManager.java:2967)](http://androidx.fragment.app.FragmentManager$11.onActivityResult(FragmentManager.java:2967))
at [androidx.fragment.app.FragmentManager$11.onActivityResult(FragmentManager.java:2939)](http://androidx.fragment.app.FragmentManager$11.onActivityResult(FragmentManager.java:2939))
at [androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:392)](http://androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:392))
at [androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:351)](http://androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:351))
at [androidx.activity.ComponentActivity.onRequestPermissionsResult(ComponentActivity.java:667)](http://androidx.activity.ComponentActivity.onRequestPermissionsResult(ComponentActivity.java:667))
at [androidx.fragment.app.FragmentActivity.onRequestPermissionsResult(FragmentActivity.java:636)](http://androidx.fragment.app.FragmentActivity.onRequestPermissionsResult(FragmentActivity.java:636))
at [android.app.Activity.requestPermissions(Activity.java:5355)](http://android.app.Activity.requestPermissions(Activity.java:5355))
at [androidx.core.app.ActivityCompat.requestPermissions(ActivityCompat.java:518)](http://androidx.core.app.ActivityCompat.requestPermissions(ActivityCompat.java:518))
at [androidx.activity.ComponentActivity$2.onLaunch(ComponentActivity.java:189)](http://androidx.activity.ComponentActivity$2.onLaunch(ComponentActivity.java:189))
at [androidx.activity.result.ActivityResultRegistry$3.launch(ActivityResultRegistry.java:226)](http://androidx.activity.result.ActivityResultRegistry$3.launch(ActivityResultRegistry.java:226))
at [androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47)](http://androidx.activity.result.ActivityResultLauncher.launch(ActivityResultLauncher.java:47))
at [androidx.fragment.app.FragmentManager.launchRequestPermissions(FragmentManager.java:3044)](http://androidx.fragment.app.FragmentManager.launchRequestPermissions(FragmentManager.java:3044))
at [androidx.fragment.app.Fragment.requestPermissions(Fragment.java:1561)](http://androidx.fragment.app.Fragment.requestPermissions(Fragment.java:1561))
at [com.czlucius.scan.ui.ScannerFragment.requestPm(ScannerFragment.java:380)](http://com.czlucius.scan.ui.ScannerFragment.requestPm(ScannerFragment.java:380))
at [com.czlucius.scan.ui.ScannerFragment.onViewCreated(ScannerFragment.java:242)](http://com.czlucius.scan.ui.ScannerFragment.onViewCreated(ScannerFragment.java:242))
at [androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987)](http://androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987))
at [androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546)](http://androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546))
at [androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)](http://androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282))
at [androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)](http://androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112))
at [androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)](http://androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647))
at [androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)](http://androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128))
at [androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:3065)](http://androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:3065))
at [androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2988)](http://androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2988))
at [androidx.fragment.app.FragmentStateManager.ensureInflatedView(FragmentStateManager.java:392)](http://androidx.fragment.app.FragmentStateManager.ensureInflatedView(FragmentStateManager.java:392))
at [androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:281)](http://androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:281))
at [androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:140)](http://androidx.fragment.app.FragmentLayoutInflaterFactory.onCreateView(FragmentLayoutInflaterFactory.java:140))
at [androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:135)](http://androidx.fragment.app.FragmentController.onCreateView(FragmentController.java:135))
at [androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:319)](http://androidx.fragment.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:319))
at [androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:298)](http://androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:298))
at [android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1073)](http://android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1073))
at [android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1001)](http://android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1001))
at [android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)](http://android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965))
at [android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)](http://android.view.LayoutInflater.rInflate(LayoutInflater.java:1127))
at [android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)](http://android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088))
at [android.view.LayoutInflater.inflate(LayoutInflater.java:686)](http://android.view.LayoutInflater.inflate(LayoutInflater.java:686))
at [android.view.LayoutInflater.inflate(LayoutInflater.java:538)](http://android.view.LayoutInflater.inflate(LayoutInflater.java:538))
at [com.czlucius.scan.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:44)](http://com.czlucius.scan.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:44))
at [com.czlucius.scan.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:38)](http://com.czlucius.scan.databinding.ActivityMainBinding.inflate(ActivityMainBinding.java:38))
at [com.czlucius.scan.ui.MainActivity.onCreate(MainActivity.java:46)](http://com.czlucius.scan.ui.MainActivity.onCreate(MainActivity.java:46))
at [android.app.Activity.performCreate(Activity.java:8282)](http://android.app.Activity.performCreate(Activity.java:8282))
at [android.app.Activity.performCreate(Activity.java:8262)](http://android.app.Activity.performCreate(Activity.java:8262))
at [android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)](http://android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329))
at [android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4011)](http://android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4011))
at [android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4203)](http://android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4203))
at [android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6340)](http://android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:6340))
at [android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6205)](http://android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:6205))
at [android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71)](http://android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:71))
at [android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)](http://android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45))
at [android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)](http://android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135))
at [android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)](http://android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95))
at [android.app.ActivityThread$H.handleMessage(ActivityThread.java:2440)](http://android.app.ActivityThread$H.handleMessage(ActivityThread.java:2440))
at [android.os.Handler.dispatchMessage(Handler.java:106)](http://android.os.Handler.dispatchMessage(Handler.java:106))
at [android.os.Looper.loopOnce(Looper.java:226)](http://android.os.Looper.loopOnce(Looper.java:226))
at [android.os.Looper.loop(Looper.java:313)](http://android.os.Looper.loop(Looper.java:313))
at [android.app.ActivityThread.main(ActivityThread.java:8641)](http://android.app.ActivityThread.main(ActivityThread.java:8641))
at java.lang.reflect.Method.invoke(Native Method)
at [com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)](http://com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567))
at [com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133)](http://com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1133))
Additional information
No response
It seems to be caused by
as after when MainActivity is in the background, it requires a handle of the bottom nav, which is not available.A patch has been pushed, will need monitoring.