Upgrade Android gradle plugin to 8.0.0 cannot let me select Java SDK

255 Views Asked by At

I'm trying to upgrade my Android gradle plugin to 8.0.0.

It seems Android Studio has a bug and cannot let me select the Java SDK.

Or to be more precise, it lets me to select it but the "Run selected steps" button remains disabled/grey.

Also, the "Upgrade project JDK for running Gradle" bullet point still remains marked with an error.

See the screenshot below.

Is there any way to do this manually or something?

Thanks in advance.

enter image description here

EDIT: I've downloaded Coretto 20 and the error is still there.

enter image description here

EDIT 2: Haha it works with Corretto 17, BUT ONLY with 17 and not with 20

And after that, it fails again:

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/8.0/userguide/gradle_daemon.html
Process command line: C:\Users\Joska\.jdks\corretto-17.0.8\bin\java.exe -XX:MaxPermSize=512m --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx1024m -Dfile.encoding=windows-1250 -Duser.country=HU -Duser.language=hu -Duser.variant -cp C:\Users\Joska\.gradle\wrapper\dists\gradle-8.0-bin\ca5e32bp14vu59qr306oxotwh\gradle-8.0\lib\gradle-launcher-8.0.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.0
Please read the following process output to find out more:
-----------------------
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

-----------------------
Check the JVM arguments defined for the gradle process in:
 - <a href="C:\android_projects\my-app-android\gradle.properties">gradle.properties</a> in project root directory
2

There are 2 best solutions below

3
On

As stated in the dialog, Gradle 8 requires JDK 17 and it seems you don't have it installed on your machine. To do so, you should click on "Download JDK...", select one of the available JDK 17 (for instance Corretto, Jetbrain etc) and restart the migration procedure.

Hope this helps

0
On

Just download it and install it from the Oracle site. Make sure to setup the path variables correctly depending on your system.