[Solved] The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Android\Android Studio\jre\bin\java.exe

2023/01/31 14:51

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching libmain.dart on AOSP on IA Emulator in debug mode…
Running Gradle task ‘assembleDebug’…

FAILURE: Build failed with an exception.

* What went wrong:
The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:Program FilesAndroidAndroid Studiojrebinjava.exe

* Try:
> Run with –stacktrace option to get the stack trace.
> Run with –info or –debug option to get more log output.
> Run with –scan to get full insights.

* Get more help at https://help.gradle.org
Exception: Gradle task assembleDebug failed with exit code 1

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching libmain.dart on AOSP on IA Emulator in debug mode…
Running Gradle task ‘assembleDebug’…

ERROR: JAVA_HOME is not set and no ‘java’ command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Exception: Gradle task assembleDebug failed with exit code 1

Solution

Open CMD in administator mode and type the following command:

cd C:Program FilesAndroidAndroid Studio
mklink /D "jre" "jbr"

Leave a Reply

Back to top