'After changed JAVA.VERSION to 11 I get "Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8"
I have changed sourceCompatibility
and targetCompatibility
to JavaVersion.VERSION_11
in build. gradle files for all modules. In my PC I have JDK 11, JAVA_HOME and path are ok, in project:
But I still get
Failed to apply plugin 'com.android.internal.application'. Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: changing the IDE settings. changing the JAVA_HOME environment variable. changing
org.gradle.java.homein
gradle.properties`
my gradle.properties:
org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 org.gradle.parallel=true android.useAndroidX=true android.enableJetifier=true
Solution 1:[1]
Can you check java path in Environment variables and make sure you don't have Java 8 in path and you have java 11 or newer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Islam Assem |