Android emulator dont work in idx flutter

2 Likes

Does this happen all the time when you create a new Flutter project?

1 Like

Yes, this problem happens all the time when creating a new project on idx in the Flutter workspace, and in all projects, and I haven’t been able to solve this problem.

Just to help me debug, can you try in Chrome and let me know if the error still happens?


Even in Chrome, when creating a new Flutter project on idx, the web emulator works but the Android emulator does not. I tried creating other projects, but the same issue persists.

Let me ping our team to look into this in greater detail. Thanks for flagging this.

1 Like

You’re welcome, and I hope you resolve this issue as soon as possible. Thank you.

We’re looking into why the onCreate hook is not running.

Can you run this command manually in the terminal please to see if the android preview shows up after?

cd /home/user/myapp/android && ./gradlew
–parallel
-Pverbose=true
-Ptarget-platform=android-x86
-Ptarget=/home/user/myapp/lib/main.dart
-Pbase-application-name=android.app.Application
-Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw==
-Pdart-obfuscation=false
-Ptrack-widget-creation=true
-Ptree-shake-icons=false
-Pfilesystem-scheme=org-dartlang-root
assembleDebug

hey i try this cmd but still this is not working giving me error my internet working well
this i give me error in both way when i create project and import repo when import repo at that time give me error i tick the box this is flutter project

no the emulator dont work

I had the same problem, Here is a solution that worked for me:

first check if your device is authorized : in the terminal : ‘adb devices’.
it should be authorized, if not, then try to deconnect and reconnect usb device in the settings (developer mode), when the device is authorized, do ‘adb reboot’, then do ‘flutter doctor --android-licenses’, then reboot, then connect to localhost:5555 or any port the output provide… (‘adb connect locahost:5555’)

it should be good, here is the output :

 2024-06-04T15:05:56Z [android] : No supported devices found with name or id matching 'localhost:5555'.
 2024-06-04T15:05:56Z [android] : The following devices were found:
 2024-06-04T15:05:56Z [android] : Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
 2024-06-04T15:05:56Z [android] : Linux (desktop)                    • linux         • linux-x64   • Linux 5.4.0-1104-gke
 2024-06-04T15:05:56Z [android] : App state changed to : START_FAILED
 2024-06-04T15:05:57Z [web] : Launching lib/main.dart on Web Server in debug mode...
 2024-06-04T15:05:57Z [web] : Waiting for connection from debug service on Web Server...
 2024-06-04T15:06:01Z [android] : App state changed to : STARTING
 2024-06-04T15:06:01Z [web] : App state changed to : STARTING
 2024-06-04T15:06:01Z [android] : Flutter daemon started
 2024-06-04T15:06:01Z [web] : Flutter daemon started
 2024-06-04T15:06:01Z [web] : Error: Waiting for another flutter command to release the startup lock...
 2024-06-04T15:06:02Z [android] : No supported devices found with name or id matching 'localhost:5555'.
 2024-06-04T15:06:02Z [android] : The following devices were found:
 2024-06-04T15:06:02Z [android] : Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
 2024-06-04T15:06:02Z [android] : Linux (desktop)                    • linux         • linux-x64   • Linux 5.4.0-1104-gke
 2024-06-04T15:06:02Z [android] : App state changed to : START_FAILED
 2024-06-04T15:06:02Z [web] : Launching lib/main.dart on Web Server in debug mode...
 2024-06-04T15:06:03Z [web] : Waiting for connection from debug service on Web Server...
 2024-06-04T15:06:27Z [web] : lib/main.dart is being served at http://0.0.0.0:9002
 2024-06-04T15:06:27Z [web] : The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
 2024-06-04T15:06:27Z [web] : App state changed to : RUNNING
 2024-06-04T15:06:31Z [android] : App state changed to : STARTING
 2024-06-04T15:06:31Z [web] : App state changed to : STARTING
 2024-06-04T15:06:31Z [android] : Flutter daemon started
 2024-06-04T15:06:31Z [web] : Flutter daemon started
 2024-06-04T15:06:31Z [android] : Error: Waiting for another flutter command to release the startup lock...

 2024-06-04T15:06:32Z [web] : Launching lib/main.dart on Web Server in debug mode...
 2024-06-04T15:06:32Z [web] : Waiting for connection from debug service on Web Server...
 2024-06-04T15:06:32Z [android] : Launching lib/main.dart on Android SDK built for x86 in debug mode...
 2024-06-04T15:06:33Z [android] : Running Gradle task 'assembleDebug'...
 2024-06-04T15:06:56Z [android] : Error: One or more plugins require a higher Android NDK version.

 2024-06-04T15:06:56Z [android] : Error: Fix this issue by adding the following to /home/user/myapp/android/app/build.gradle:

 2024-06-04T15:06:56Z [android] : Error: android {

 2024-06-04T15:06:56Z [android] : Error:   ndkVersion "25.1.8937393"

 2024-06-04T15:06:56Z [android] : Error:   ...

 2024-06-04T15:06:56Z [android] : Error: }

 2024-06-04T15:06:56Z [android] : Error: 

 2024-06-04T15:06:58Z [android] : Checking the license for package NDK (Side by side) 25.1.8937393 in /opt/android/licenses
 2024-06-04T15:06:58Z [android] : License for package NDK (Side by side) 25.1.8937393 accepted.
 2024-06-04T15:06:58Z [android] : Preparing "Install NDK (Side by side) 25.1.8937393 (revision: 25.1.8937393)".
 2024-06-04T15:07:07Z [web] : lib/main.dart is being served at http://0.0.0.0:9002
 2024-06-04T15:07:07Z [web] : The web-server device requires the Dart Debug Chrome extension for debugging. Consider using the Chrome or Edge devices for an improved development workflow.
 2024-06-04T15:07:07Z [web] : App state changed to : RUNNING
 2024-06-04T15:07:18Z [android] : "Install NDK (Side by side) 25.1.8937393 (revision: 25.1.8937393)" ready.
 2024-06-04T15:07:18Z [android] : Installing NDK (Side by side) 25.1.8937393 in /opt/android/ndk/25.1.8937393
 2024-06-04T15:07:18Z [android] : "Install NDK (Side by side) 25.1.8937393 (revision: 25.1.8937393)" complete.
 2024-06-04T15:07:18Z [android] : "Install NDK (Side by side) 25.1.8937393 (revision: 25.1.8937393)" finished.
 2024-06-04T15:07:18Z [android] : Checking the license for package CMake 3.18.1 in /opt/android/licenses
 2024-06-04T15:07:18Z [android] : License for package CMake 3.18.1 accepted.
 2024-06-04T15:07:18Z [android] : Preparing "Install CMake 3.18.1 (revision: 3.18.1)".
 2024-06-04T15:07:20Z [android] : "Install CMake 3.18.1 (revision: 3.18.1)" ready.
 2024-06-04T15:07:20Z [android] : Installing CMake 3.18.1 in /opt/android/cmake/3.18.1
 2024-06-04T15:07:20Z [android] : "Install CMake 3.18.1 (revision: 3.18.1)" complete.
 2024-06-04T15:07:20Z [android] : "Install CMake 3.18.1 (revision: 3.18.1)" finished.
 2024-06-04T15:07:21Z [android] : Checking the license for package Android SDK Platform 31 in /opt/android/licenses
 2024-06-04T15:07:21Z [android] : License for package Android SDK Platform 31 accepted.
 2024-06-04T15:07:21Z [android] : Preparing "Install Android SDK Platform 31 (revision: 1)".
 2024-06-04T15:07:24Z [android] : "Install Android SDK Platform 31 (revision: 1)" ready.
 2024-06-04T15:07:24Z [android] : Installing Android SDK Platform 31 in /opt/android/platforms/android-31
 2024-06-04T15:07:24Z [android] : "Install Android SDK Platform 31 (revision: 1)" complete.
 2024-06-04T15:07:24Z [android] : "Install Android SDK Platform 31 (revision: 1)" finished.
 2024-06-04T15:09:56Z [android] : ✓ Built build/app/outputs/flutter-apk/app-debug.apk
 2024-06-04T15:09:56Z [android] : Installing build/app/outputs/flutter-apk/app-debug.apk...
 2024-06-04T15:10:06Z [android] : Syncing files to device Android SDK built for x86...
 2024-06-04T15:10:06Z [android] : App state changed to : RUNNING
 2024-06-04T15:10:06Z [android] : D/eglCodecCommon( 6698): setVertexArrayObject: set vao to 0 (0) 1 0
 2024-06-04T15:10:08Z [android] : D/EGL_emulation( 6698): eglMakeCurrent: 0xf494bba0: ver 3 0 (tinfo 0xea3a6440)
 2024-06-04T15:10:08Z [android] : D/eglCodecCommon( 6698): setVertexArrayObject: set vao to 0 (0) 1 0
 2024-06-04T15:10:08Z [android] : I/m.example.myap( 6698): NativeAlloc concurrent copying GC freed 7991(907KB) AllocSpace objects, 3(60KB) LOS objects, 51% free, 1444KB/2980KB, paused 16.482ms total 132.746ms```
2 Likes

don’t work brother
I don’t know why

I too face the same problem with no solution. i had to restart my project 3 times (removed and imported from GIT).