Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error:Cause: scala/util/Properties$ : Unsupported major.minor version 52.0 #66

Closed
ssuukk opened this issue Jul 18, 2015 · 5 comments
Closed

Comments

@ssuukk
Copy link

ssuukk commented Jul 18, 2015

My project used to build before, now (all of the sudden) it fails with:

Error:Cause: scala/util/Properties$ : Unsupported major.minor version 52.0

I couldn't get any info on this error, the only thing I discovered that it is caused by this line in build.gradle:

apply plugin: 'jp.leafytree.android-scala'

More info here: http://stackoverflow.com/questions/31492714/building-android-app-with-scala-bad-class-file-magic/31494910#31494910

Might that be due to some scala class being compiled to java 8? If yes, what can I do? I tried everything, including removing android studio, caches, sbt, gradle, scala jars, libraries, anything named "scala" etc.

Some more info from log:

Caused by: java.lang.UnsupportedClassVersionError: scala/util/Properties$ : Unsupported major.minor version 52.0
at java_lang_ClassLoader$loadClass.call(Unknown Source)
at jp.leafytree.gradle.AndroidScalaPlugin.scalaVersionFromClasspath(AndroidScalaPlugin.groovy:132)
at jp.leafytree.gradle.AndroidScalaPlugin$scalaVersionFromClasspath$0.callStatic(Unknown Source)
at jp.leafytree.gradle.AndroidScalaPlugin.addAndroidScalaCompileTask(AndroidScalaPlugin.groovy:184)
at jp.leafytree.gradle.AndroidScalaPlugin$_apply_closure4_closure18.doCall(AndroidScalaPlugin.groovy:84)
at jp.leafytree.gradle.AndroidScalaPlugin$_apply_closure4.doCall(AndroidScalaPlugin.groovy:83)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:83)

@saturday06
Copy link
Owner

That log shows that scala/util/Properties (scala-library jar) was compiled to java8.
I guess, your project uses scala-library 2.12.0-M2 . It's compiled to java8 class file.
If it doesn't use that version, please upload your build.gradle for analysis

@ssuukk
Copy link
Author

ssuukk commented Jul 19, 2015

Ive verified that my scala library jars were compiled for 50.0

BUT!.. My android studio recreates it as 52.0 in gradle cache! Why?

Project:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'http://download.crashlytics.com/maven' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
        // scala
        classpath 'jp.leafytree.gradle:gradle-android-scala-plugin:1.+'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'http://download.crashlytics.com/maven' }
    }
}

Module:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    defaultConfig {
        applicationId "pl.qus.xenoamp"
        minSdkVersion 15
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            minifyEnabled true
        }
    }

    packagingOptions {
        exclude 'META-INF/beans.xml'
        exclude 'about.html'
    }

    dexOptions {
        jumboMode true
        incremental true
        javaMaxHeapSize "1g"
    }
}

apply plugin: 'crashlytics'
// SCALA
apply plugin: 'com.android.application'
// SCALA
apply plugin: 'jp.leafytree.android-scala'

dependencies {

    // SCALA
    compile 'org.scala-lang:scala-library:2.+'
    compile project(':standOut')
    // override buga https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=175086
    // potem można usunąć excludy i bibliotękę v4, jak to naprawią
    //compile('com.android.support:cardview-v7:22.1.1') {
    //    force = true
    //}
    //compile('com.android.support:palette-v7:22.1.1') {
    //    force = true
    //}

    compile 'com.android.support:cardview-v7:+'
    compile 'com.android.support:palette-v7:+'
    compile 'com.android.support:appcompat-v7:+'

    compile 'com.google.code.gson:gson:2.3'
    compile 'com.google.android.gms:play-services-identity:+'
    compile 'com.google.android.gms:play-services-base:+'
    compile 'com.google.android.gms:play-services-ads:+'
    compile 'com.crashlytics.android:crashlytics:1.+'
    compile 'de.greenrobot:eventbus:2.4.+'
    //compile 'com.google.android.gms:play-services-cast:7.0.0'
    //compile 'com.android.support:support-v4:22.0.0'
    //compile 'com.android.support:mediarouter-v7:22.0.0'
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        // exclusion is not necessary, but generally a good idea.
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile fileTree(include: ['avocarrot-sdk-*.jar'], dir: 'libs')
    compile files('libs/cling-core-2.0.1.jar')
    compile files('libs/cling-support-2.0.1.jar')
    compile files('libs/seamless-xml-1.1.0.jar')
    compile files('libs/seamless-http-1.1.0.jar')
    compile files('libs/seamless-util-1.1.0.jar')
    compile files('libs/cuelib-1.2.1-2008-06-13.jar')
    compile files('libs/dropbox-android-sdk-1.6.3.jar')
    compile files('libs/jdom-2.0.6.jar')
    compile files('libs/json-simple-1.1.1.jar')
    compile files('libs/jetty-client-8.1.17.v20150415.jar')
    compile files('libs/jetty-continuation-8.1.17.v20150415.jar')
    compile files('libs/jetty-http-8.1.17.v20150415.jar')
    compile files('libs/jetty-io-8.1.17.v20150415.jar')
    compile files('libs/jetty-security-8.1.17.v20150415.jar')
    compile files('libs/jetty-server-8.1.17.v20150415.jar')
    compile files('libs/jetty-servlet-8.1.17.v20150415.jar')
    compile files('libs/jetty-util-8.1.17.v20150415.jar')
    compile files('libs/servlet-api-3.0.jar')
    compile files('libs/slf4j-jdk14-1.7.12.jar')
}

@saturday06
Copy link
Owner

Following code downloads and uses scala-library 2.12.0-M1.

    compile 'org.scala-lang:scala-library:2.+'

It's unsupported by gradle-android-scala-plugin because scala-library 2.12.* depends on java8 (see also README.md)

Please use scala-library 2.11 series:

    compile 'org.scala-lang:scala-library:2.11.+'

@saturday06
Copy link
Owner

You can check your scala-library version to execute ./gradlew dependencies -p $your_app_project_dir

@ssuukk
Copy link
Author

ssuukk commented Jul 20, 2015

Aaaah... I wouldn't have thought that a minor version number would bring such a big change. Thanks for your response, I guess you can close this.

@ssuukk ssuukk closed this as completed Jul 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants