Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

App crash on orientation change #208

Closed
subinsv opened this issue Apr 14, 2020 · 3 comments
Closed

App crash on orientation change #208

subinsv opened this issue Apr 14, 2020 · 3 comments
Labels

Comments

@subinsv
Copy link

subinsv commented Apr 14, 2020

Plugin Version: 3.0.0-dev.2
Platform: Android
Device: Redmi k20 pro
Android 10

App crashes during orientation change on scanner view.

E/AndroidRuntime(21498): kotlin.UninitializedPropertyAccessException: lateinit property scannerView has not been initialized
E/AndroidRuntime(21498): 	at de.mintware.barcode_scan.BarcodeScannerActivity.onCreateOptionsMenu(BarcodeScannerActivity.kt:78)
E/AndroidRuntime(21498): 	at android.app.Activity.onCreatePanelMenu(Activity.java:4142)
E/AndroidRuntime(21498): 	at com.android.internal.policy.PhoneWindow.preparePanel(PhoneWindow.java:652)
E/AndroidRuntime(21498): 	at com.android.internal.policy.PhoneWindow.doInvalidatePanelMenu(PhoneWindow.java:1045)
E/AndroidRuntime(21498): 	at com.android.internal.policy.PhoneWindow$1.run(PhoneWindow.java:284)
E/AndroidRuntime(21498): 	at com.android.internal.policy.PhoneWindow.doPendingInvalidatePanelMenu(PhoneWindow.java:1016)
E/AndroidRuntime(21498): 	at com.android.internal.policy.PhoneWindow.restoreHierarchyState(PhoneWindow.java:2186)
E/AndroidRuntime(21498): 	at android.app.Activity.onRestoreInstanceState(Activity.java:1602)
E/AndroidRuntime(21498): 	at android.app.Activity.performRestoreInstanceState(Activity.java:1557)
E/AndroidRuntime(21498): 	at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1354)
E/AndroidRuntime(21498): 	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3344)
E/AndroidRuntime(21498): 	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
E/AndroidRuntime(21498): 	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
E/AndroidRuntime(21498): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
E/AndroidRuntime(21498): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
E/AndroidRuntime(21498): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2040)
E/AndroidRuntime(21498): 	at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(21498): 	at android.os.Looper.loop(Looper.java:224)
E/AndroidRuntime(21498): 	at android.app.ActivityThread.main(ActivityThread.java:7520)
E/AndroidRuntime(21498): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21498): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
E/AndroidRuntime(21498): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
E/MQSEventManagerDelegate(21498): failed to get MQSService.
@devtronic devtronic added the bug label Apr 14, 2020
@devtronic
Copy link
Member

I'll take a look on that today.

Maybe the problem is this:

if (scannerViewInitialized) {
    return
}

should be

if (scannerView != null) {
    return
}

@subinsv
Copy link
Author

subinsv commented Apr 14, 2020

Let me try this.
If it works, I will create a PR.

subinsv pushed a commit to subinsv/flutter_barcode_reader that referenced this issue Apr 14, 2020
subinsv pushed a commit to subinsv/flutter_barcode_reader that referenced this issue Apr 14, 2020
subinsv pushed a commit to subinsv/flutter_barcode_reader that referenced this issue Apr 14, 2020
@devtronic
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants