I'm learning flutter, and went to continue after a few weeks since I last touched the project. Out of habit I installed the updated on Ubuntu (24.04) and now for some reason the java bin can't run.Also when I tried running without debugging, the JAVA_HOME isn't being read.
Also for some reason, the flutter doctor -v
command is not thorough, as I do have Android Studio installed, as well as Chrome.
Note: When trying to debug on the Host machine (Linux) device, it at least tried to start a window and got that far. To me that almost means the Android device emulator isn't accessing the JAVA_HOME path.
[user]@workstation:~$ echo $JAVA_HOME/usr/lib/jvm/java-1.21.0-openjdk-amd64
~/Projects/namer_app$ flutter doctor -v[✓] Flutter (Channel stable, 3.22.3, on Freedesktop SDK 23.08 (Flatpak runtime) 6.8.0-41-generic, locale en_US.UTF-8)• Flutter version 3.22.3 on channel stable at /home/[user]/snap/flutter/common/flutter• Upstream repository https://github.com/flutter/flutter.git• Framework revision b0850beeb2 (7 weeks ago), 2024-07-16 21:43:41 -0700• Engine revision 235db911ba• Dart version 3.4.4• DevTools version 2.34.3[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)• Android SDK at /home/[user]/Android/Sdk• Platform android-34, build-tools 34.0.0• ANDROID_SDK_ROOT = /home/[user]/Android/Sdk• Java binary at: /usr/lib/jvm/java-1.21.0-openjdk-amd64/bin/java✗ Cannot execute /usr/lib/jvm/java-1.21.0-openjdk-amd64/bin/java to determine the version[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.[✓] Linux toolchain - develop for Linux desktop• clang version 10.0.0-4ubuntu1• cmake version 3.16.3• ninja version 1.10.0• pkg-config version 0.29.1[!] Android Studio (not installed)• Android Studio not found; download from https://developer.android.com/studio/index.html (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).[✓] Connected device (1 available)• Linux (desktop) • linux • linux-x64 • Freedesktop SDK 23.08 (Flatpak runtime) 6.8.0-41-generic[✓] Network resources• All expected network resources are available.! Doctor found issues in 3 categories.
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-1.21.0-openjdk-amd64Please set the JAVA_HOME variable in your environment to match thelocation of your Java installation.Error: Gradle task assembleDebug failed with exit code 1Exited (1).