Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Android studio JRE default path?

Launching lib\main.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 Files\Android\android studio\jre\bin\java.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.

like image 667
D B Avatar asked Sep 07 '25 00:09

D B


1 Answers

After Android Studio Electric Eel | 2022.1.1 update, JAVA_HOME path is changed jre->jbr. So, you should update .zshrc file.

From terminal,

  1. Type open ~/.zshrc and update the path

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home

  1. To apply changes, you need to restart the terminal
like image 131
omral Avatar answered Sep 09 '25 16:09

omral