I've all done, setting JAVA_HOME, JAVA8_HOME, ... and i had always the error.
For me the solution was to set the version 2.1.0 of gradle to work with Jdk 1.8.0_92 and android studio 2.11
Android Studio behaves weird in the case. Even though you set the JDK version in File -> Project Structure -> SDK Location, Android Studio only uses this for compiling the files. When it runs these files it, for some reason, looks at the PATH variable to find where java is installed.
If you have an older version of java installed on your system, then your PATH variable will be pointing to that older version of java.
So you have to set your PATH to point to the same version of java that have set in your Android studio project settings.
In your ~/.bashrc or corresponding profile file add this:
This error "Unsupported major.minor version 52.0" refers to the java compiler, although the string "major.minor" looks very similar to the Android SDK version format.
On Windows platform, asides updating jdk to 1.8, make sure JAVA_HOME point to where your jdk 1.8 is installed (i.e. C:\Program Files\Java\jdk1.8.0_91).
For those of you, who are still facing this.
I got this problem after I upgraded to Android Studio to 2.1.2.
I was stuck at this problem for about an hour, I tried these solutions:
multidexEnabled true
increasing the memory for deamon thread
upgraded to Java 8
I double checked the gradle scripts and found this:
compileSdkVersion 23
buildToolsVersion "24.0.0"
changed to:
compileSdkVersion 23
buildToolsVersion "23.0.3"
I don't know how this caused the error, but this did the trick for me.
Please let me know how this worked if you know the answer.
Thanks
change to
buildToolsVersion "23.0.2" in app gradle file.
I've all done, setting JAVA_HOME, JAVA8_HOME, ... and i had always the error. For me the solution was to set the version 2.1.0 of gradle to work with Jdk 1.8.0_92 and android studio 2.11
Android Studio behaves weird in the case. Even though you set the JDK version in File -> Project Structure -> SDK Location, Android Studio only uses this for compiling the files. When it runs these files it, for some reason, looks at the PATH variable to find where java is installed.
If you have an older version of java installed on your system, then your PATH variable will be pointing to that older version of java.
So you have to set your PATH to point to the same version of java that have set in your Android studio project settings.
In your ~/.bashrc or corresponding profile file add this:
In my case my project was configured to use java 1.8, but my system wide installation of java was java 1.7. This was causing the issue.
This error "Unsupported major.minor version 52.0" refers to the java compiler, although the string "major.minor" looks very similar to the Android SDK version format.
On Windows platform, asides updating jdk to 1.8, make sure JAVA_HOME point to where your jdk 1.8 is installed (i.e. C:\Program Files\Java\jdk1.8.0_91).
For me the problem was that the version of gradle in build.gradle was not same as the actual gradle version I had installed.
dependencies { classpath('com.android.tools.build:grade:2.2.0') { force = true}
Check your installed gradle versions at /Contents/gradle/m2repository/com/android/tools/build/gradle/ and change the above build.gradle file with
classpath('com.android.tools.build:grade:1.5.1')
or <>For those of you, who are still facing this. I got this problem after I upgraded to Android Studio to 2.1.2. I was stuck at this problem for about an hour, I tried these solutions:
I double checked the gradle scripts and found this:
changed to:
I don't know how this caused the error, but this did the trick for me. Please let me know how this worked if you know the answer. Thanks