Closed hohoan closed 3 years ago
Same problem here... You find some solution? And this problem start with me recently, after make some updates on flutter framework (up to 1.22.3) and .gradle from android package. I guess that gradle version isn't directly related to the bug, but the flutter new version and perhaps the new Android Studio 4.1 have some connection.
Same problem over here.
Quick solution for CameraSource.java
@SuppressLint("Assert")
void release() {
assert (mProcessingThread == null || mProcessingThread.getState() == State.TERMINATED);
if (mDetector != null) {
mDetector.release();
mDetector = null;
}
}
Quick solution for CameraSource.java
@SuppressLint("Assert") void release() { assert (mProcessingThread == null || mProcessingThread.getState() == State.TERMINATED); if (mDetector != null) { mDetector.release(); mDetector = null; } }
Thank you @xinoxapps ! This provisional solution works fine here. And i can complement this help for someone have minimal poblems to find the function release into the CameraSource.java: be careful, because this release function is into FrameProcessingRunnable class (have another release function on the begin of the file that remets to the release of resouces).
Same problem for me. I'm new to Flutter can you please let me know how to fix the issue.
Same problem for me. I'm new to Flutter can you please let me know how to fix the issue.
@rohitvedula17 , you can make this changes in external libraries path from your project.
External Libraries > Flutter Pluggins > flutter_barcode_scanner
As image below:
@Kiraneki This works for me. Thanks for the help and prompt response. Sorry I Saw the message today, hence the late reply. @xinoxapps Thanks for your solution.
thanks for your solution @xinoxapps , @Kiraneki
This should not be closed as the solution is not yet implemented on the repository code @hohoan
Thanks for you solution also
This should not be closed as the solution is not yet implemented on the repository code
Yes, plz fix in main repository and release new version
When this will be fixed?
@mindhalt You may have better luck trying a fork of this project since the maintainer seems to have abandoned this issue.
can someone fix this whole package with nullsafety? or at least empart some knowledge on how to do it? I will myself if I could learn how... really need the android and iOS version of OCR to work too
When I press button EXIT, my app force close. Please help me My Code: Future scanBarcodeNormal() async {
String barcodeScanRes;
try {
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
"#ff6666", "EXIT", true, ScanMode.BARCODE);
if (barcodeScanRes != "-1") {
print(barcodeScanRes);
}
} on PlatformException {
barcodeScanRes = 'Failed to get platform version.';
}
if (!mounted) return;
setState(() {
});
}
Here my error:
E/AndroidRuntime(21975): FATAL EXCEPTION: main
E/AndroidRuntime(21975): Process: abc.test, PID: 21975
E/AndroidRuntime(21975): java.lang.RuntimeException: Unable to destroy activity {abc.test/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(21975): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4167)
E/AndroidRuntime(21975): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4185)
E/AndroidRuntime(21975): at android.app.ActivityThread.-wrap6(ActivityThread.java)
E/AndroidRuntime(21975): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1521)
E/AndroidRuntime(21975): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(21975): at android.os.Looper.loop(Looper.java:154)
E/AndroidRuntime(21975): at android.app.ActivityThread.main(ActivityThread.java:6077)
E/AndroidRuntime(21975): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21975): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime(21975): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
E/AndroidRuntime(21975): 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(21975): at com.amolg.flutterbarcodescanner.camera.CameraSource$FrameProcessingRunnable.release(CameraSource.java:967)
E/AndroidRuntime(21975): at com.amolg.flutterbarcodescanner.camera.CameraSource.release(CameraSource.java:273)
E/AndroidRuntime(21975): at com.amolg.flutterbarcodescanner.camera.CameraSourcePreview.release(CameraSourcePreview.java:84)
E/AndroidRuntime(21975): at com.amolg.flutterbarcodescanner.BarcodeCaptureActivity.onDestroy(BarcodeCaptureActivity.java:266)
E/AndroidRuntime(21975): at android.app.Activity.performDestroy(Activity.java:6864)
E/AndroidRuntime(21975): at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1153)
E/AndroidRuntime(21975): at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4154)
E/AndroidRuntime(21975): ... 9 more