I\'m trying to compile my Android project and I\'m getting this error
[INFO] Exception in thread \"main\" java.lang.UnsupportedClassVersionError: com/android
I had the same problem and tried to change the version, sometimes is for the version of Android Studio in Project> Gradle Scripts> build.gradle(Module:app) you can change the version. For example:
android {
compileSdkVersion **23**
buildToolsVersion **"23.0.3"**
defaultConfig {
applicationId "com.example.android.myapplication"
minSdkVersion **19**
targetSdkVersion **23**
versionCode **1**
versionName **"1.0"**
}
I face this problem too when making new project from android studio.
I've been able to resolve this by downgrading buildToolsVersion in app gradle setting: change {module-name}/build.gradle line
buildToolsVersion "24.0.0 rc1"
to
buildToolsVersion "23.0.3"
@Edit:
In Android Studio 2.1 Go to File-> Project Structure->App -> Build Tool Version. Change it to 23.0.3
Do the method above, only when you are using java version 7 and for some reason do not want to upgrade to java 8 yet.
Hope this helps
I had the same problem with my IntelliJ Maven build. My "solution" was to go into the build tools and remove the build tools 24.0.0 folder. I found it in the {android-sdk-location}/build-tools/
directory. This is not a long term fix, but this should at least get your project building again. Upgrading to Java 8 as many have suggested will be better long term.
unsupported-major-minor-version error can be because of unsupported JDK version. Update JDK, Go to Module Settings and change the JDK path to the new one. In most of the cases, it fixes the error.