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.

Crash after scanning - Android

See original GitHub issue

Describe the bug When scanning a barcode the application crashes with this error:

E/AndroidRuntime(19560): java.lang.RuntimeException: Unable to destroy activity {xxxx/com.amolg.flutterbarcodescanner.BarcodeCaptureActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Thread$State java.lang.Thread.getState()' on a null object reference
E/AndroidRuntime(19560): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5438)
E/AndroidRuntime(19560): 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5472)
E/AndroidRuntime(19560): 	at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
E/AndroidRuntime(19560): 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
E/AndroidRuntime(19560): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
E/AndroidRuntime(19560): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2270)
E/AndroidRuntime(19560): 	at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(19560): 	at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime(19560): 	at android.app.ActivityThread.main(ActivityThread.java:8125)
E/AndroidRuntime(19560): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(19560): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
E/AndroidRuntime(19560): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
E/AndroidRuntime(19560): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Thread$State java.lang.Thread.getState()' on a null object reference
E/AndroidRuntime(19560): 	at com.amolg.flutterbarcodescanner.camera.CameraSource$FrameProcessingRunnable.release(CameraSource.java:967)
E/AndroidRuntime(19560): 	at com.amolg.flutterbarcodescanner.camera.CameraSource.release(CameraSource.java:273)
E/AndroidRuntime(19560): 	at com.amolg.flutterbarcodescanner.camera.CameraSourcePreview.release(CameraSourcePreview.java:84)
E/AndroidRuntime(19560): 	at com.amolg.flutterbarcodescanner.BarcodeCaptureActivity.onDestroy(BarcodeCaptureActivity.java:266)
E/AndroidRuntime(19560): 	at android.app.Activity.performDestroy(Activity.java:8219)
E/AndroidRuntime(19560): 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1342)
E/AndroidRuntime(19560): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5423)
E/AndroidRuntime(19560): 	... 11 more

To Reproduce Just follow the example in the documentation. Nothing done in Android.

Smartphone (please complete the following information):

  • Device: Samsung S9
  • OS: Android 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
Dev-Heisenbergcommented, Jan 19, 2021

write this code here!! ------------------------>>>>>>>
@SuppressLint(“Assert”) void release() { assert (mProcessingThread == null || mProcessingThread.getState() == State.TERMINATED); if (mDetector != null) { mDetector.release(); mDetector = null; } } 99072724-574cc000-2593-11eb-971b-2ee9e3700190

3reactions
AmolGangadharecommented, Jan 5, 2021

The potential fix has been made and the new version is available 1.0.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android app crash when scanning TOTP QR Code #1228
I have never been able to scan a QR code from within the bitwarden app, it crashes on both official and custom roms...
Read more >
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 >
Why does my phone crash when I scan barcodes - Google Help
As I proceeded to scan my items I noticed after the first scan my pixel 4xl goes black, and the only way to...
Read more >
App is crashing after capture image/scan QR code in android 12
In my app user can capture images and scan QR code. App is working fine in all android versions expect android 12. App...
Read more >
Scanner crashes | Scanner Pro Knowledge Base
We'll ask you for crash logs - the data the app generates when it crashes. It contains information related to where the issues...
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