I\'m trying to compile my Android project and I\'m getting this error
[INFO] Exception in thread \"main\" java.lang.UnsupportedClassVersionError: com/android
You need to go into your SDK installation directory, and make sure that the /build-tools sub-directory matches the buildToolsVersion
in your app's build.gradle file:
Check that you have the latest version of the SDK installed in either C:\Program Files\Java
or C:\Program Files (x86)\Java
Then go to VS2015 and follow the path tools - options - Xamarin - Android settings and in the section JDK location select change and go to look for the version you have either x64 or x32.
Changing com.android.tools.build:gradle:2.2.0-beta1
to com.android.tools.build:gradle:2.1.2
fixed it for me.
My Android Studio version is 2.1.2, perhaps that's why
The Simplest solution is you have to update your JDK to latest, version . Because Cordova supports only latest JDK .
1. First of all you have to update your Android SDK. Then,
2. If you are not able to update through your terminal , Got to your Software center of Linux destro and search the Latest (which one you want to install) and install that one .
Then again run Cordova build .
It will solve the problem .
In ,my case it worked.
Thanks everyone for solution.
I could solve my same problem using below solution.
In my project, I added jar which were created in Java8. And my project was referring to JRE 7. When i changed project JRE to 8. My problem solved.
Steps: In eclipse, right click on project name in project explorer > build path > Libraries > click on jre version > click edit > installed JRE > add > standerd VM > select JRE home click-path (path should be localePath\java\jdk1.8.0_25\jre) > provide name > save > select same JRE for project > finish > ok Refresh/build project once > try to run your java file. it should work.
I am on cordova, here's what I've done:
- rename your android project, so that there's space for new one
- update JAVA Development Kit to 1.8 (latest one in time of writing this)
- run cordova platform add android
Should work without problems now. Your app hash will change, so if you are using it f.e. for facbeook login, you will need to update it