How can I update my Java 1.8 to Java 11 for the Android Gradle plugin?

123    Asked by BernadetteBond in Java , Asked on Jan 5, 2024

When I was developing an Android application I encountered an error message that was showing that the “Android Gradle plugin requires Java 11 to run. You are currently using 1.8” How can I update my Java version to 11 from 1.8 for the Android Gradle plugin so that I can troubleshoot this particular error? 

f you are consistently getting the error message “Android Gradle plugin requires Java 11 to run . You are currently using 1.8” then you seriously need to update your Java version to 11 to avoid this error during the process of developing any application. To upgrade your Java version to 11 you would need to install Java Development Kit 11 first. Here is the process given to update your Java version:-

Install Java Development Kit 11

First, install the Java Development Kit 11 (JDK 11) from the website of Oracle.

Set JAVA HOME

After installing the Java development kit version 11 now you would need to set java_ home. For this update your system environment variables for pointing the directory where the java development kit is installed.

Update gradle setting

Open your Android project and find the “gradle.properties” file. Now add or update the following command for specifying the Java version

  “ org.gradle.java.home=/path/to/your/JDK11”

Sync Gradle

After making the above changes in the gradle setting, now sync the changes in Android Studio or you can also use the command line for syncing the gradle. Thus will finally apply the new Java version setting for you.



Your Answer

Interviews

Parent Categories