Motaz khogali
Motaz khogali

Reputation: 21

Flutter Run show message "Lost connection to device." after run app in emulator

I had this old project I wanted to make some updates. I start by updating the all packages and migrating to null safety all goes good. and updated my flutter version to 3.7.4 but when run on emulator the logo come out but crash after that and this is run log :

Running Gradle task 'assembleDebug'... √ Built build\app\outputs\flutter-apk\app-debug.apk. D/FlutterGeolocator( 6309): Attaching Geolocator to activity D/FlutterGeolocator( 6309): Creating service. D/FlutterGeolocator( 6309): Binding to location service. D/FlutterGeolocator( 6309): Geolocator foreground service connected D/FlutterGeolocator( 6309): Initializing Geolocator services D/FlutterGeolocator( 6309): Flutter engine connected. Connected engine count 1 Lost connection to device.

note: working find on real device anyone can help ?

expecting to work fine as will as the working in real device

i all ready try flutter clean


I update the emulator and i have some more info about in run log here its :

Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... Running Gradle task 'assembleDebug'... √ Built build\app\outputs\flutter-apk\app-debug.apk. D/FlutterGeolocator(13885): Attaching Geolocator to activity D/FlutterGeolocator(13885): Creating service. D/FlutterGeolocator(13885): Binding to location service. D/FlutterGeolocator(13885): Geolocator foreground service connected D/FlutterGeolocator(13885): Initializing Geolocator services D/FlutterGeolocator(13885): Flutter engine connected. Connected engine count 1 E/AndroidRuntime(13885): FATAL EXCEPTION: main E/AndroidRuntime(13885): Process: com.APPID, PID: 13885 E/AndroidRuntime(13885): java.lang.NoSuchMethodError: No interface method addWindowLayoutInfoListener(Landroid/app/Activity;Lj$/util/function/Consumer;)V in class Landroidx/window/extensions/layout/WindowLayoutComponent; or its super classes (declaration of 'androidx.window.extensions.layout.WindowLayoutComponent' appears in /system_ext/framework/androidx.window.extensions.jar) E/AndroidRuntime(13885): at androidx.window.layout.ExtensionWindowLayoutInfoBackend.registerLayoutChangeCallback(ExtensionWindowLayoutInfoBackend.kt:68) E/AndroidRuntime(13885): at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invokeSuspend(WindowInfoTrackerImpl.kt:52) E/AndroidRuntime(13885): at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(Unknown Source:8) E/AndroidRuntime(13885): at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1.invoke(Unknown Source:4) E/AndroidRuntime(13885): at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) E/AndroidRuntime(13885): at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212) E/AndroidRuntime(13885): at androidx.window.java.layout.WindowInfoTrackerCallbackAdapter$addListener$1$1.invokeSuspend(WindowInfoTrackerCallbackAdapter.kt:96) E/AndroidRuntime(13885): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) E/AndroidRuntime(13885): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) E/AndroidRuntime(13885): at android.os.Handler.handleCallback(Handler.java:942) E/AndroidRuntime(13885): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(13885): at android.os.Looper.loopOnce(Looper.java:201) E/AndroidRuntime(13885): at android.os.Looper.loop(Looper.java:288) E/AndroidRuntime(13885): at android.app.ActivityThread.main(ActivityThread.java:7898) E/AndroidRuntime(13885): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(13885): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E/AndroidRuntime(13885): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) Lost connection to device.

Upvotes: 0

Views: 1633

Answers (1)

Motaz khogali
Motaz khogali

Reputation: 21

It turned out that after updating the library flutter_local_notifications Add this tow lines

implementation 'androidx.window:window:1.0.0'
implementation 'androidx.window:window-java:1.0.0'

to the file android/app/build.gradle fix the Problem

answer found in Flutter chrash in Android 12l with "No interface method addWindowLayoutInfoListener"

Upvotes: 2

Related Questions