Launching libmain.dart on sdk gphone64 x86 64 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
Android Studio version:
Android Studio Electric Eel | 2022.1.1 Canary 9 Build
#AI-221.5921.22.2211.8881706, built on July 29, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
2
Answers
Not sure if this is what you need, but you can change the Java JDK that Gradle uses by going to Settings -> Build, Execution, Deployment -> Build Tools -> Gradle and change the Gradle JDK settings.
You can also change the JAVA_HOME environment variable (not sure if name is the same on different OS) or "changing
org.gradle.java.home
ingradle.properties
."After Android Studio Electric Eel | 2022.1.1 update, JAVA_HOME path is changed
jre->jbr
. So, you should update .zshrc file.From terminal,
open ~/.zshrc
and update the pathexport JAVA_HOME=/Applications/Android Studio.app/Contents/jbr/Contents/Home