Skip to content Skip to sidebar Skip to footer

Android Gradle Build In Command Line Error: Unsupportedclassversionerror

Build inside android studio works, but failed with command line build > gradlew tasks java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported

Solution 1:

Fix your JAVA_HOME variable.

The error means there are classes compiled with Java 8 (52.0) that you are trying to use with an older Java version.

When you use Android Studio obviously Java 8 is used to run Gradle, but when you use the Gradle wrapper from commandline, the value of JAVA_HOME is used to execute Gradle.

This is set to Java 7 or older on your machine and thus the build fails as soon as it tries to use the Java class that was compiled with Java 8, in your case a part of the Android Gradle plugin.

Solution 2:

make sure gradle plugins are latest:

classpath 'com.android.tools.build:gradle:2.3.3'

Post a Comment for "Android Gradle Build In Command Line Error: Unsupportedclassversionerror"