Unable to launch app in Android emulator: Stuck on 'Flutter: Launching…' and 'Waiting for observatory port to be available…'

Issue

I’m dealing with a very frustrating problem where I am unable to launch my app with my Android emulator. I am using VS Code and Android Studio for the emulator. It keeps getting hung up.

When I try to launch from VS Code (Run > Start Debugging), it hangs on Flutter: Launching...
enter image description here

When I try to launch from Powershell (flutter run --verbose), it hangs on Waiting for observatory port to be available…

[ +228 ms] Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x20000000 cmp=com.ceventures.app.locationalerts.cedric.eicher/.MainActivity (has extras) }
[   +4 ms] Waiting for observatory port to be available...

Initially, going down some rabbit holes online led me to think my package/app id might be wrong. Here are what they are in all locations:

android/app/src/main/AndroidManifest.xml:

package="com.ceventures.app.locationalerts.cedric.eicher">

android/app/src/profile/AndroidManifest.xml:

package="com.ceventures.app.locationalerts.cedric.eicher">

android/app/src/debug/AndroidManifest.xml:

package="com.ceventures.app.locationalerts.cedric.eicher">

android/app/build.gradle:

defaultConfig {
applicationId "com.ceventures.app.locationalerts.cedric.eicher"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

android/app/google-services.json:

"package_name": "com.ceventures.app.locationalerts.cedric.eicher"

android/app/src/main/kotlin/com/example/locationalertsapp/MainActivity.kt:

package com.ceventures.app.locationalerts.cedric.eicher

Things I have tried:

  • flutter clean
  • Changing all names to com.example.locationalertsapp
  • Clean boot emulator, increasing storage size, wipe data clean, trying other emulator devices
  • Restarting my machine, upgrading flutter, deleting the flutter/bin/cache directory
  • Updating Android Studio to the latest version

Any help is appreciated, this is driving me crazy! It just worked a few days ago!

Solution

SOLVED — NOTE I AM OP

So after a week of dealing with this, the following led me to getting things to finally work:

  1. Doing a windows update

  2. Switching to the flutter stable branch, and then doing flutter upgrade

  3. Doing a cold boot of my emulator device

  4. Resolving pubspec package issues and the environment: and sdk: versions worked for all the packages (if they don’t, you’ll be alerted)

  5. Updating the following to the original com.example.locationalertsapp

    android/app/src/main/AndroidManifest.xml
    android/app/src/profile/AndroidManifest.xml
    android/app/src/debug/AndroidManifest.xml

I really don’t know why this all worked. I had to step away from this issue for a few days just because I couldn’t handle it anymore and I felt like I was down rabbit hole after rabbit hole.

Hopefully this helps someone in the future!

Answered By – usafutb0l3r

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published