giandifra / arcore_flutter_plugin

Flutter plugin for ARCore SDK, Android platform to build new augmented reality experiences
MIT License
435 stars 280 forks source link

Crash with QrScan plugins #40

Open Nyerca opened 4 years ago

Nyerca commented 4 years ago

Im trying to use this plugin with: import 'package:qrscan/qrscan.dart' as scanner;

But when i run: String barcode = await scanner.scan();

The app crashes, while if i dont put: ArCoreView( onArCoreViewCreated: _onArCoreViewCreated, enableTapRecognizer: true, ) In my code then it works.

How can i solve this? thank you!

That's the error i get: I/com.difrancescogianmarco.arcore_flutter_plugin.ArCoreView( 9820): onActivityPaused I/native ( 9820): session.cc:1154 Entering Session::Pause. W/native ( 9820): calibration_convergence_detector_utils.cc:143 Failed to get calibration qualification statistics: States are empty. I/native ( 9820): online_calibration_manager.cc:126 OnlineCalibrationManager: Discarding the new online recalibration estimates. I/native ( 9820): cameras.cc:1309 Camera 0 changed state CAPTURING->STOPPING; Capture session stopping... i=2 E/ACameraDevice( 9820): onDeviceIdle sending state cb I/native ( 9820): android_camera.cc:1617 [Camera=0; State=STOPPING] Camera completed repeating capture sequence 0 I/native ( 9820): logger.h:28 CameraMetrics: LastCaptureComplete: 233.815312ms I/native ( 9820): logger.h:28 CameraMetrics: CloseCaptureSession: 206.000938ms I/native ( 9820): cameras.cc:1309 Camera 0 changed state STOPPING->OPEN; Camera stopped. i=3 I/native ( 9820): logger.h:28 CameraMetrics: CloseCamera: 111.259687ms I/native ( 9820): cameras.cc:1309 Camera 0 changed state OPEN->CLOSED; Camera device closed successfully. i=4 I/native ( 9820): logger.h:28 DataSourceMetrics: kStopImageSubSystem: 551.795989ms I/native ( 9820): session.cc:1239 Session::PauseWithAnalytics returning OK. I/Choreographer( 9820): Skipped 33 frames! The application may be doing too much work on its main thread. W/ActivityThread( 9820): handleWindowVisibility: no activity for token android.os.BinderProxy@edfedec D/AndroidRuntime( 9820): Shutting down VM E/AndroidRuntime( 9820): FATAL EXCEPTION: main E/AndroidRuntime( 9820): Process: com.example.flutterapp4, PID: 9820 E/AndroidRuntime( 9820): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.flutterapp4/com.shinow.qrscan.SecondActivity}: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter savedInstanceState E/AndroidRuntime( 9820): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3276) E/AndroidRuntime( 9820): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) E/AndroidRuntime( 9820): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) E/AndroidRuntime( 9820): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime( 9820): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime( 9820): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2022) E/AndroidRuntime( 9820): at android.os.Handler.dispatchMessage(Handler.java:107) E/AndroidRuntime( 9820): at android.os.Looper.loop(Looper.java:359) E/AndroidRuntime( 9820): at android.app.ActivityThread.main(ActivityThread.java:7418) E/AndroidRuntime( 9820): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 9820): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime( 9820): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) E/AndroidRuntime( 9820): Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter savedInstanceState E/AndroidRuntime( 9820): at com.difrancescogianmarco.arcore_flutter_plugin.ArCoreView$setupLifeCycle$1.onActivityCreated(Unknown Source:7) E/AndroidRuntime( 9820): at android.app.Application.dispatchActivityCreated(Application.java:373) E/AndroidRuntime( 9820): at android.app.Activity.dispatchActivityCreated(Activity.java:1202) E/AndroidRuntime( 9820): at android.app.Activity.onCreate(Activity.java:1475) E/AndroidRuntime( 9820): at androidx.core.app.ComponentActivity.onCreate(ComponentActivity.java:81) E/AndroidRuntime( 9820): at androidx.activity.ComponentActivity.onCreate(ComponentActivity.java:149) E/AndroidRuntime( 9820): at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:313) E/AndroidRuntime( 9820): at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106) E/AndroidRuntime( 9820): at com.shinow.qrscan.SecondActivity.onCreate(SecondActivity.java:36) E/AndroidRuntime( 9820): at android.app.Activity.performCreate(Activity.java:7802) E/AndroidRuntime( 9820): at android.app.Activity.performCreate(Activity.java:7791) E/AndroidRuntime( 9820): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) E/AndroidRuntime( 9820): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3251)

BrutalCoding commented 4 years ago

Try again with this PR that I just submitted: https://github.com/giandifra/arcore_flutter_plugin/pull/63

You can specify a specific commit and git repo in pubspec.yaml. If you want to use my fork, which also has this fix, you can do the following:

arcore_flutter_plugin:
    git:
      url: https://github.com/BrutalCoding/arcore_flutter_plugin.git