Closed avestnik closed 9 years ago
I am getting exactly the same error with same setup
Same here.
Caused by: java.lang.UnsupportedClassVersionError: me/tatarka/RetrolambdaPlugin : Unsupported major.minor version 52.0
at org.gradle.api.internal.plugins.DefaultPluginRegistry.getTypeForId(DefaultPluginRegistry.java:104)
at org.gradle.api.internal.plugins.DefaultPluginContainer.getTypeForId(DefaultPluginContainer.java:183)
at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:103)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:115)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:131)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:37)
at org.gradle.api.Project$apply$0.call(Unknown Source)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)
at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)
at build_aaf1sc683lzoi46tbsb8qzj2v.run(/home/tomrozb/workspace/bb/app/build.gradle:2)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
... 42 more
What version of java are you running gradle with?
I tried both 1.7.0.65 and 1.8.0.25. Both Java and windows 8.1 are 64 bits
I ran into this as well.
The interesting tidbit I have to contribute is that NOT having a JAVA_HOME
defined makes the build work. In other words: if I define just JAVA8_HOME
it works, but if I have both JAVA_HOME
and JAVA8_HOME
I get this error.
I had the same problem. I tried changing JAVA_HOME in several variations but it didn't help.
My solution was changing JDK location in module settings in Android Studio. Before this change it was set to java7 which was not working for me.
My build.gradle relevant parts look like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.fada21.android.x"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
apply plugin: 'me.tatarka.retrolambda'
retrolambda {
jvmArgs '-noverify'
jdk System.getenv("JAVA8_HOME")
oldJdk System.getenv("JAVA7_HOME")
javaVersion JavaVersion.VERSION_1_7
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:21.0.3"
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:1.+'
}
@fada21 solution doesn't work for me because I've already set it to the same path.
Any progress on this issue?
I`m experiencing same problem on my Ubuntu machine:
export JAVA_HOME="/usr/lib/jvm/java-7-oracle"
export JAVA6_HOME="/usr/lib/jvm/java-6-oracle"
export JAVA7_HOME="/usr/lib/jvm/java-7-oracle"
export JAVA8_HOME="/usr/lib/jvm/java-8-oracle"
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'me.tatarka:gradle-retrolambda:2.5.0'
}
}
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
retrolambda {
jdk System.getenv("JAVA8_HOME")
oldJdk System.getenv("JAVA6_HOME")
javaVersion JavaVersion.VERSION_1_6
}
dependencies {
compile project(":rest")
compile 'com.jakewharton.timber:timber:2.5.0'
compile 'io.reactivex:rxandroid:0.23.0'
compile 'com.squareup.retrofit:retrofit:1.8.0'
}
Any explanation what does this message really mean?
Just a heads up, it was as simple as changing the SDK path in project settings to point to my JDK 8 home directory. I had started my project before including this plugin and was at that pointed to 7, but during setup for this library installed 8, but didn't update my project settings. Updating the path fixed the issue for me. HTH
@tomkoptel Have you changed SDK path in project settings as @bennythomps said? I've posted previously an image with hint how it should look like.
Yep, that helped me :)
At the moment I'm using Android Studio 1.0.2
. Also, I've launched studio from console command by launching sh script so that idea could properly pick environment variables.
./your_location/android-studio/bin/studio.sh &
Though the final step was changing JDK location in module settings in Android Studio as suggested @fada21.
For us the issue was a java-library that was part of an Android project. For whatever reason it believed it was jdk 6, and the sdk wasn't around. There definitely should more logging around failures in the plugin itself but we were able to get things running by adding this to the library:
retrolambda {
javaVersion JavaVersion.VERSION_1_7
}
On top of making sure JAVA_HOME
was not set.
I fixed this by changing module's Java SDK path to JDK *8
this thing must be included to README
Hi all FYI, It's happening randomly for a couple of weeks now. I can get rid of it only adding
org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home
to my gradle.properties
. JAVA_HOME
and JAVA8_HOME
are properly set too.
Ivan
@hamen thanks, that worked...
@magicgoose Your solution worked. Cheers!
setting org.gradle.java.home works for me. Thanks @hamen
For me the only thing that worked was setting adding:
gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
To idea.properties
file. In my case it lives here:
/Applications/IntelliJ IDEA 14.app/Contents/bin/idea.properties
And then, restart IntelliJ, obviously.
I have found this here.
I am a Mac OS X (10.9 - Mavericks) user.
If you want to automatically update all your IntelliJs installations, I have made a script to do so here: https://gist.github.com/alcarvalho/26fb041de96f6cf30e91
Note that if you ever update your jdk 8 version, you should update the file as well.
Sorry for the delay, but I think I got to the bottom to this. The latest version of gradle-retrolambda was compiled with java 8, making it not work if you ran gradle with a lower java version. All the workarounds above ensure that you are running gradle with java 8.
Since my intention was to allow you to run gradle with a lower java version (as long as it can find java 8 to actually compile your source code), this will be fixed in the next version.
Fixed in 3.0.0
I have the trable (Unsupported major.minor version 52.0
) in fresh version classpath 'me.tatarka:gradle-retrolambda:3.2.3'
. What did i do wrong? There is my gist https://gist.github.com/kolipass/ebaa82476a89946e0505 .
I try to use jvmArgs '-noverify'
and projectlombok then i have lombok/ast/Node : Unsupported major.minor version 52.0
If i didn't use projectlombok i received java.lang.UnsupportedClassVersionError Unsupported major.minor version 52.0
for every test.
Solution: export JAVA_HOME=$JAVA8_HOME
Also be sure you are not using "Android version to use when rendering layouts in IDE" button with Andriod N (preview) set, choose another version.
I solved this by installing Java 8 and changing the JDK location to the new Java 8, rebuilt gradle and everything worked perfectly.
Unset JAVA_HOME and JAVA8_HOME, set JDK8 path in Android studio project settings. Restart android studio if you unset JAVA_HOME while android studio is running.
@lozery
If you're using Eclipse
wait, what? someone does still use it for Android development? why?
Change build gradle version it's work for me before: -classpath 'com.android.tools.build:gradle:2.2.0' after: -classpath 'com.android.tools.build:gradle:2.1.3'
I also faced the same problem, it can be solved by following two steps:
Step 1: Download Java 8. Step 2: Update Android Studio to the latest version 2.2.
Note that current Anndroid tools/google libraries require JDK8 or you will get "Unsupported major.minor version 52.0". This is true even if you are not using Retrolambda.
Adding this line to gradle.properties
file, solved the issue:
org.gradle.java.home=/usr/java/jdk1.8.0_45/
I met this issue too
Go to File --> other setting --> Default project structure... --> check the check box of use embedded jdk cheers^^
I was wondering if Java7 works in the issue. It does not work in my win7/JDK1.7, anyone knows?
For me I just had to restart Android Studio, lol.
Hi All,
I was also facing same issue: Error:(1, 1) A problem occurred evaluating project ':app'.
java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
I just updated JDK location on below setting(from "JDK 1.7" to "C:\Program Files\Android\Android Studio\" and select the check box for Embedded JDK).
File->Other Settings=>Default Project Struture
keep getting error in Android Studio 1.0.1
JAVA7_HOME=C:\Program Files\Java\jdk1.7.0_65 JAVA8_HOME=C:\Program Files\Java\jdk1.8.0_25 JAVA_HOME=C:\Program Files\Java\jdk1.8.0_25