Flutter App stuck in emulator at "Waiting for VM Service port to be available..."
Asked Answered
C

5

10

I have a project of a friend where I am supposed to help him. He codes on Mac with an IPhone simulator. Since I have no Mac I want to use an Android simulator which should be no problem if I am informed correctly since flutter creates for android and apple files. I installed Android Studio for this and generated a Pixel XL API 34 for my VS Code. When I try to run the code while I have the emulator chosen the App is not working on the simulator. After clicking a couple times on it, I always get a white screen and then it goes back to home screen until the massage "app keeps stopping" occurs. I googled a lot now so I also found the "flutter run -v" command and when I use it, it always stops at the point "Waiting for VM Service port to be available...". After a while it shows the following "Error waiting for a debug connection: The log reader stopped unexpectedly" and changes back from emulator to windows device. terminal

error

I dont have a single clue how to continue especially since I am completely new to this. Flutter doctor also says everything is fine. Flutter clean did not change anything. Since my friend coded already a lot I cannot provide the code. But I will of course if you tell me what you need provide all necessary informations. emulator

I have seen in other questions that dependencies could be important, so I run the flutter pub get command and got this: Resolving dependencies... _fe_analyzer_shared 61.0.0 (64.0.0 available) analyzer 5.13.0 (6.2.0 available) build 2.4.0 (2.4.1 available) build_resolvers 2.2.0 (2.3.2 available)
build_runner 2.4.5 (2.4.6 available)
built_value 8.6.1 (8.6.2 available) cancellation_token 1.6.1 (2.0.1 available)
chat_bubbles 1.4.1 (1.5.0 available)
code_builder 4.5.0 (4.6.0 available)
collection 1.17.2 (1.18.0 available)
connectivity_plus 3.0.6 (4.0.2 available)
dart_style 2.3.1 (2.3.2 available) decimal 2.3.2 (2.3.3 available) ffi 2.0.2 (2.1.0 available) file 6.1.4 (7.0.0 available) flutter_blue_plus 1.14.11 (1.15.5 available) flutter_hooks 0.18.6 (0.20.1 available)
flutter_lints 2.0.1 (2.0.3 available)
gql 0.14.0 (1.0.0 available) gql_error_link 0.2.3+1 (1.0.0 available)
gql_exec 0.4.3 (1.0.0 available) gql_http_link 0.4.5 (1.0.1 available)
gql_link 0.5.1 (1.0.0 available) gql_transform_link 0.2.2+1 (1.0.0 available) http 0.13.6 (1.1.0 available) material_color_utilities 0.5.0 (0.8.0 available) meta 1.9.1 (1.10.0 available) normalize 0.7.2 (0.8.2+1 available) objectid 2.1.0 (3.0.0 available) path_provider 2.0.15 (2.1.1 available) path_provider_android 2.0.27 (2.2.0 available) path_provider_foundation 2.2.3 (2.3.1 available) path_provider_linux 2.1.11 (2.2.1 available) path_provider_platform_interface 2.0.6 (2.1.1 available) path_provider_windows 2.1.7 (2.2.1 available) petitparser 5.4.0 (6.0.1 available) platform 3.1.0 (3.1.2 available) plugin_platform_interface 2.1.4 (2.1.6 available) process 4.2.4 (5.0.0 available) realm 1.2.0 (1.4.0 available) realm_common 1.2.0 (1.4.0 available) realm_dart 1.2.0 (1.4.0 available) realm_generator 1.2.0 (1.4.0 available) sane_uuid 1.0.0-alpha.4 (1.0.0-alpha.5 available) source_gen 1.3.2 (1.4.0 available) stack_trace 1.11.0 (1.11.1 available) stream_channel 2.1.1 (2.1.2 available) syncfusion_flutter_charts 21.2.10 (22.2.12 available) syncfusion_flutter_core 21.2.10 (22.2.12 available) tar 0.5.6 (1.0.1 available) test_api 0.6.0 (0.6.1 available) uuid 3.0.7 (4.0.0 available) web_socket_channel 2.2.0 (2.4.0 available) win32 5.0.3 (5.0.7 available) xdg_directories 1.0.0 (1.0.3 available) xml 6.3.0 (6.4.2 available) Got dependencies!

Cranage answered 14/9, 2023 at 14:2 Comment(1)
I have this issue too. Able to launch emulator and run basic app, when I add firebase to the project, I get this error. I am running Flutter 3.13.6, on MacOS Sonoma 14.Shall
K
4

I got the same issue. In my case it got resolved when ik corrected the MainActivity.kt file. The package name defined in this file should correspond with the namespace defined in the build.gradle file. It was not the same after a migration of my project to a new pc.

Kenway answered 5/11, 2023 at 14:14 Comment(0)
G
1

This will come when I change the package name in build.gradle. To fix this issue, I copied the old package name and added it into AndroidManifest.xml before MainActivity.

E.g The old package name is com.abc Then

<activity
            android:name="com.abc.MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
Gardas answered 23/12, 2023 at 6:44 Comment(0)
L
1

I experienced the issue when i migrated my project to new machine.

The package name in MainActivity.kt was not correct due to whatever reasons, so had to change it to correct on as it appears in AndroidManifest.xml. Then rerunning the application and everything worked like charm.

Latchet answered 25/12, 2023 at 17:21 Comment(0)
R
1

In my case, my package name was completely different in MainActivity.kt I changed it back and then did flutter run. Works like a charm now

Ricardo answered 10/2, 2024 at 10:19 Comment(0)
T
0

In my case, My mobile was locked when tried to debug. I unlocked it allowed debug pop up. And running now.

Thermogenesis answered 24/8, 2024 at 7:49 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.