Works fine on debug and profile mode, not works on release mode - flutter

The app works fine on debug and profile mode but not on release mode. When I click the button "listen to voice" it crashes. In debug and profile mode, I click it and there is no problem. I run my app with this: flutter run --release and I see this error:
E/AndroidRuntime(24397): FATAL EXCEPTION: main
E/AndroidRuntime(24397): Process: com.konukcustudio.sprien, PID: 24397
E/AndroidRuntime(24397): java.lang.IllegalStateException: Module with the Main dispatcher is missing. Add dependency providing the Main dispatcher, e.g. 'kotlinx-coroutines-android' and ensure it has the same version as 'kotlinx-coroutines-core'
E/AndroidRuntime(24397): at g.a.x1.p.a(Unknown Source:4)
E/AndroidRuntime(24397): at g.a.x1.q.h(Unknown Source:55)
E/AndroidRuntime(24397): at g.a.x1.q.b(Unknown Source:0)
E/AndroidRuntime(24397): at g.a.x1.e.a(Unknown Source:16)
E/AndroidRuntime(24397): at g.a.y1.a.a(Unknown Source:15)
E/AndroidRuntime(24397): at g.a.y1.a.a(Unknown Source:5)
E/AndroidRuntime(24397): at g.a.d0.a(Unknown Source:41)
E/AndroidRuntime(24397): at g.a.a.a(Unknown Source:3)
E/AndroidRuntime(24397): at g.a.d.a(Unknown Source:22)
E/AndroidRuntime(24397): at g.a.c.a(Unknown Source:0)
E/AndroidRuntime(24397): at g.a.d.a(Unknown Source:12)
E/AndroidRuntime(24397): at g.a.c.a(Unknown Source:0)
E/AndroidRuntime(24397): at c.c.a.a.g.a(Unknown Source:139)
E/AndroidRuntime(24397): at c.c.a.a.b.onMethodCall(Unknown Source:706)
E/AndroidRuntime(24397): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
E/AndroidRuntime(24397): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(Unknown Source:57)
E/AndroidRuntime(24397): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(Unknown Source:4)
E/AndroidRuntime(24397): at android.os.MessageQueue.nativePollOnce(Native Method)
E/AndroidRuntime(24397): at android.os.MessageQueue.next(MessageQueue.java:326)
E/AndroidRuntime(24397): at android.os.Looper.loop(Looper.java:181)
E/AndroidRuntime(24397): at android.app.ActivityThread.main(ActivityThread.java:7050)
E/AndroidRuntime(24397): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(24397): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
E/AndroidRuntime(24397): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Hi this problem has already been discussed here
just
add these as dependencies (check latest version too)
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.6'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.6'
Sometimes in 'debug' mode errors are shown as warnings.
Please provide the log and a bit of code when performing the same function when in ' --debug ' mode.

Related

Lost connection to device flutter [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 15 hours ago.
Improve this question
when i use this _serviceEnabled = await location.requestService();
to enable location in emulator i get this error
///////////////////////////////////////////////////////
but if the location is on it will run
///////////////////////////////////////////
and i updated all thinks
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
√ Built build\app\outputs\flutter-apk\app-debug.apk.
D/FlutterGeolocator( 9756): Attaching Geolocator to activity
D/FlutterGeolocator( 9756): Creating service.
D/FlutterGeolocator( 9756): Binding to location service.
D/FlutterLocationService( 9756): Creating service.
D/FlutterLocationService( 9756): Binding to location service.
D/FlutterGeolocator( 9756): Geolocator foreground service connected
D/FlutterGeolocator( 9756): Initializing Geolocator services
D/FlutterGeolocator( 9756): Flutter engine connected. Connected engine count 1
Connecting to VM Service at ws://127.0.0.1:54470/XMa3BfDCzxo=/ws
E/AndroidRuntime( 9756): FATAL EXCEPTION: main
E/AndroidRuntime( 9756): Process: com.example.map, PID: 9756
E/AndroidRuntime( 9756): java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.SettingsClient, but class was expected (declaration of 'com.google.android.gms.location.SettingsClient' appears in /data/app/~~nx2Rt28p5mjXBK5Owysq_A==/com.example.map-qaIT0zpByZNHS_Yr4lvDaA==/base.apk)
E/AndroidRuntime( 9756): at com.lyokone.location.FlutterLocation.requestService(FlutterLocation.java:388)
E/AndroidRuntime( 9756): at com.lyokone.location.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:55)
E/AndroidRuntime( 9756): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/AndroidRuntime( 9756): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime( 9756): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/AndroidRuntime( 9756): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/AndroidRuntime( 9756): at android.os.Handler.handleCallback(Handler.java:938)
E/AndroidRuntime( 9756): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 9756): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime( 9756): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime( 9756): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/AndroidRuntime( 9756): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 9756): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime( 9756): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
I/Process ( 9756): Sending signal. PID: 9756 SIG: 9
Lost connection to device.
Exited (sigterm)
to enable gps in device

!!! FAILED BINDER TRANSACTION !!! (parcel size = 624). IGmsServiceBroker.getService failed when calling verifyPhoneNumber()

my phoneAuth is working perfectly fine until i changed my project bundleId and redownloaded the google-service.json file.
in Ios, my app is being killed leaving no stack trace at all, in android, i'm getting this below stack trace but not sure what the problem is since i'm new to coding and dont know how to read stack trace.
what I've tried:
flutter clean
flutter pub get
flutter pub cache repair
deleted build folder, .gradle folder , pods, podfile.lock and ran flutter run -v to recreate the deleted files but nothing happened.
any help would be greatly appreciated. i can give some more information if needed.
E/JavaBinder(12658): !!! FAILED BINDER TRANSACTION !!! (parcel size = 624)
W/GmsClient(12658): IGmsServiceBroker.getService failed
W/GmsClient(12658): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
W/GmsClient(12658): at android.os.BinderProxy.transactNative(Native Method)
W/GmsClient(12658): at android.os.BinderProxy.transact(BinderProxy.java:584)
W/GmsClient(12658): at com.google.android.gms.common.internal.zzac.getService(com.google.android.gms:play-services-basement##18.1.0:8)
W/GmsClient(12658): at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(com.google.android.gms:play-services-basement##18.1.0:14)
W/GmsClient(12658): at com.google.android.gms.common.api.internal.zabt.run(com.google.android.gms:play-services-base##18.0.1:7)
W/GmsClient(12658): at android.os.Handler.handleCallback(Handler.java:942)
W/GmsClient(12658): at android.os.Handler.dispatchMessage(Handler.java:99)
W/GmsClient(12658): at android.os.Looper.loopOnce(Looper.java:201)
W/GmsClient(12658): at android.os.Looper.loop(Looper.java:288)
W/GmsClient(12658): at android.os.HandlerThread.run(HandlerThread.java:67)
E/JavaBinder(12658): !!! FAILED BINDER TRANSACTION !!! (parcel size = 624)
W/GmsClient(12658): IGmsServiceBroker.getService failed
W/GmsClient(12658): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
W/GmsClient(12658): at android.os.BinderProxy.transactNative(Native Method)
W/GmsClient(12658): at android.os.BinderProxy.transact(BinderProxy.java:584)
W/GmsClient(12658): at com.google.android.gms.common.internal.zzac.getService(com.google.android.gms:play-services-basement##18.1.0:8)
W/GmsClient(12658): at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(com.google.android.gms:play-services-basement##18.1.0:14)
W/GmsClient(12658): at com.google.android.gms.common.api.internal.zabt.run(com.google.android.gms:play-services-base##18.0.1:7)
W/GmsClient(12658): at android.os.Handler.handleCallback(Handler.java:942)
W/GmsClient(12658): at android.os.Handler.dispatchMessage(Handler.java:99)
W/GmsClient(12658): at android.os.Looper.loopOnce(Looper.java:201)
W/GmsClient(12658): at android.os.Looper.loop(Looper.java:288)
W/GmsClient(12658): at android.os.HandlerThread.run(HandlerThread.java:67)
E/JavaBinder(12658): !!! FAILED BINDER TRANSACTION !!! (parcel size = 624)
W/GmsClient(12658): IGmsServiceBroker.getService failed
W/GmsClient(12658): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
W/GmsClient(12658): at android.os.BinderProxy.transactNative(Native Method)
W/GmsClient(12658): at android.os.BinderProxy.transact(BinderProxy.java:584)
W/GmsClient(12658): at com.google.android.gms.common.internal.zzac.getService(com.google.android.gms:play-services-basement##18.1.0:8)
W/GmsClient(12658): at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(com.google.android.gms:play-services-basement##18.1.0:14)
W/GmsClient(12658): at com.google.android.gms.common.api.internal.zabt.run(com.google.android.gms:play-services-base##18.0.1:7)
W/GmsClient(12658): at android.os.Handler.handleCallback(Handler.java:942)
W/GmsClient(12658): at android.os.Handler.dispatchMessage(Handler.java:99)
W/GmsClient(12658): at android.os.Looper.loopOnce(Looper.java:201)
W/GmsClient(12658): at android.os.Looper.loop(Looper.java:288)
W/GmsClient(12658): at android.os.HandlerThread.run(HandlerThread.java:67)
W/FirebaseAuth(12658): [SmsRetrieverHelper] Timed out waiting for SMS.
E/FirebaseAuth(12658): [SmsRetrieverHelper] SmsRetrieverClient failed to start: 22: API failed to connect while resuming due to an unknown error.

Failing to run Flutter app on a different machine

I have been working on a flutter project for a while now, but I had to change the PC I am using for some reasons. the thing is that every time I try to run the app I get bunch of errors then the app crashes and the connection get lost. I tried to run the app from the old PC again and It worked fine.
This is the stack of errors I get before the crash:
E/LB (21021): fail to open file: No such file or directory
I/m.example.test(21021): ProcessProfilingInfo new_methods=92 is saved saved_to_disk=1 resolve_classes_delay=8000
D/DecorView: getWindowModeFromSystem windowmode is 1
I/flutter (21021): True
E/AndroidRuntime(21021): FATAL EXCEPTION: flutter-worker-1
E/AndroidRuntime(21021): Process: com.example.test1, PID: 21021
E/AndroidRuntime(21021): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/tekartik/sqflite/LogLevel;
E/AndroidRuntime(21021): at com.tekartik.sqflite.SqflitePlugin.onOpenDatabaseCall(SqflitePlugin.java:733)
E/AndroidRuntime(21021): at com.tekartik.sqflite.SqflitePlugin.onMethodCall(SqflitePlugin.java:983)
E/AndroidRuntime(21021): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:261)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:321)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$SerialTaskQueue.flush(DartMessenger.java:173)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$SerialTaskQueue.lambda$dispatch$0$io-flutter-embedding-engine-dart-DartMessenger$SerialTaskQueue(DartMessenger.java:163)
E/AndroidRuntime(21021): at io.flutter.embedding.engine.dart.DartMessenger$SerialTaskQueue$$ExternalSyntheticLambda0.run(Unknown Source:2)
E/AndroidRuntime(21021): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/AndroidRuntime(21021): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/AndroidRuntime(21021): at java.lang.Thread.run(Thread.java:923)
E/AndroidRuntime(21021): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tekartik.sqflite.LogLevel" on path: DexPathList[[zip file "/data/app/~~Jf92ML0d6XYgNbFc-Me8kg==/com.example.test1-i0I0QGqwfxD8m-Juiw5BfQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~Jf92ML0d6XYgNbFc-Me8kg==/com.example.test1-i0I0QGqwfxD8m-Juiw5BfQ==/lib/arm64, /data/app/~~Jf92ML0d6XYgNbFc-Me8kg==/com.example.test1-i0I0QGqwfxD8m-Juiw5BfQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
E/AndroidRuntime(21021): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
E/AndroidRuntime(21021): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(21021): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(21021): ... 12 more
I/Process (21021): Sending signal. PID: 21021 SIG: 9
Lost connection to device.
Anyone have any idea of what is going on here?
Thanks in advance.
Are you sure you have the same version of flutter as the computer you are using? You can check this thread

How to resolve java.lang.NoClassDefFoundError errors in flutter?

When I run the app from flutter to the Android simulator, the following error is returned, and it does not run, I don't know what the problem is, please advise on the error.
Launching lib/main.dart on Android SDK built for arm64 in debug mode...
lib/main.dart:1
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Connecting to VM Service at ws://127.0.0.1:57149/NUW2Tq4P_Hg=/ws
E/AndroidRuntime( 8510): FATAL EXCEPTION: main
E/AndroidRuntime( 8510): Process: com.example.qnsdk_example, PID: 8510
E/AndroidRuntime( 8510): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/localbroadcastmanager/content/LocalBroadcastManager;
E/AndroidRuntime( 8510): at com.yolanda.health.qnblesdk.out.QNBleApi.setBleDeviceDiscoveryListener(QNBleApi.java:787)
E/AndroidRuntime( 8510): at com.example.qnsdk.QNSdkPlugin.setBleDeviceDiscoveryListener(QNSdkPlugin.kt:146)
E/AndroidRuntime( 8510): at com.example.qnsdk.QNSdkPlugin.onMethodCall(QNSdkPlugin.kt:82)
E/AndroidRuntime( 8510): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/AndroidRuntime( 8510): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/AndroidRuntime( 8510): at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/AndroidRuntime( 8510): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$R4HPk6oFVb-i-YR_PN9YE6kqx1I.run(Unknown Source:12)
E/AndroidRuntime( 8510): at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime( 8510): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime( 8510): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 8510): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 8510): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 8510): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 8510): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/AndroidRuntime( 8510): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.localbroadcastmanager.content.LocalBroadcastManager" on path: DexPathList[[zip file "/data/app/com.example.qnsdk_example-cDdo9nfJTxqNGC_B2Gxa2g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.qnsdk_example-cDdo9nfJTxqNGC_B2Gxa2g==/lib/arm64, /data/app/com.example.qnsdk_example-cDdo9nfJTxqNGC_B2Gxa2g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]
E/AndroidRuntime( 8510): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
E/AndroidRuntime( 8510): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime( 8510): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime( 8510): ... 14 more
I/flutter ( 8510): initSDK 1108
I/Process ( 8510): Sending signal. PID: 8510 SIG: 9
Lost connection to device.
Exited (sigterm)
and in the sdk manager
android sdk command-line tools (latest)
I followed it because I had to check it, but the error does not go away and continues.
Try this:
Open Tools > SDK Manager
choose Appearance & Behavior > System Settings > Android SDK
Select SDK Tools
Check Android SDK Command-line tools and click ‘apply’.

Flutter StreamProvider with CloudFirestore causing error on Resume

Having a weird issue and cant seem to figure out if I have something setup wrong (new with Providers and streams) or if its a bug. Everything seems to work fine except when the app resumes after being backed out with the back button, on Android, and then restarted. Steps to reproduce:
Launch App
hit back button to close app (not just minimize)
Relaunch app
I get the following error:
D/AndroidRuntime( 3566): Shutting down VM
E/AndroidRuntime( 3566): FATAL EXCEPTION: main
E/AndroidRuntime( 3566): Process: com.crimsonowl.scryer, PID: 3566
E/AndroidRuntime( 3566): java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference
E/AndroidRuntime( 3566): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:429)
E/AndroidRuntime( 3566): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:402)
E/AndroidRuntime( 3566): at com.google.firebase.firestore.DocumentReference.lambda$addSnapshotListenerInternal$2(com.google.firebase:firebase-firestore##21.3.0:504)
E/AndroidRuntime( 3566): at com.google.firebase.firestore.DocumentReference$$Lambda$3.onEvent(Unknown Source:6)
E/AndroidRuntime( 3566): at com.google.firebase.firestore.core.AsyncEventListener.lambda$onEvent$0(com.google.firebase:firebase-firestore##21.3.0:42)
E/AndroidRuntime( 3566): at com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run(Unknown Source:6)
E/AndroidRuntime( 3566): at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime( 3566): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime( 3566): at com.google.android.gms.internal.tasks.zzb.dispatchMessage(com.google.android.gms:play-services-tasks##17.0.2:6)
E/AndroidRuntime( 3566): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 3566): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 3566): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 3566): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 3566): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process ( 3566): Sending signal. PID: 3566 SIG: 9
After a lot of debugging and trying to figure out what was causing it. Ive narrow the problem down to StreamProvider and my user data. In my main screen I load a stream of the Users data with this:
return FutureProvider.value(
value: Provider.of<IAPProvider>(context).initialize(),
child: StreamProvider<User>.value(
value: DatabaseProvider().streamUser(user.uid),
child: MainScreen(),
),
);
And the code for the stream is this:
Stream<User> streamUser(String id) {
return Firestore.instance
.collection(USER_COLLECTION)
.document(id)
.snapshots()
.map((snap) => User.fromFirestore(snap));
}
I figured out that anytime I try to write to the User document on the cloud firestore database the app crashes, but only when I have done the steps above. On the initial launch (and works fine if I relaunch after it crashes) everything works as expected. Something like this:
Firestore.instance.collection(USER_COLLECTION).document(user.uid).updateData({'last_login': FieldValue.serverTimestamp()});