Does this happen all the time when you create a new Flutter project?
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.
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```
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).
Same here i thought the problem was coming from me, I cleaned my browser cookies , tried on different browsers, used a friend’s laptop and still it was doing this. Project IDX is a great tool, kindly check and fix this for us.
Help me i cant type on android keyboard i am on mobile
i dont think they will fix it or even looking at the bug reports or the forums.
We are actively working on a fix for this. There are two things we are doing to address this issue.
-
It is partly related to capacity constraints, so we are addressing that as quickly as we can.
-
We are also porting our Android emulator stack to Nix (and decoupling it from the Flutter workspace), and this should help decouple the emulator from any Flutter-specific version changes.
Both of these are pretty large pieces of work, so we want to make sure we get it right before we deploy it broadly.
Cheers,
Kirupa
@cpp - are you referring to the Android emulator keyboard? Or are you using an Android device to develop on IDX and your device keyboard doesn’t work?
i solve the above problem from copy the dev.nix file to my newly create flutter project (from github).
here is my file content, click to copy it
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
packages = [
pkgs.jdk17
pkgs.unzip
pkgs.nodePackages.firebase-tools
];
# Sets environment variables in the workspace
env = {};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"Dart-Code.flutter"
"Dart-Code.dart-code"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
build-flutter = ''
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
# TODO: Execute web build in debug mode.
# flutter run does this transparently either way
# https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411
# flutter build web --profile --dart-define=Dart2jsOptimization=O0
adb -s localhost:5555 wait-for-device
'';
};
# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
previews = {
enable = true;
previews = {
web = {
command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"];
manager = "flutter";
};
android = {
command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"];
manager = "flutter";
};
};
};
};
}
Does this works, have anyone verified it. @kirupa