0

When I add the dependency and classpath for the plugin Permissions Dispatcher(https://github.com/hotchemi/PermissionsDispatcher) the app ceases to run, giving me this error message

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.UnsupportedClassVersionError: permissions/dispatcher/RuntimePermissions : Unsupported major.minor version 52.0

Project Gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

buildscript {
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

Module Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "me.paxana.alerta"
        minSdkVersion 21
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.parse.bolts:bolts-android:1.3.0'
    compile 'com.parse:parse-android:1.12.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:support-annotations:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.nanohttpd:nanohttpd-webserver:2.1.1'
    compile ('com.mapbox.mapboxsdk:mapbox-android-sdk:3.0.0@aar'){
        transitive=true}
}

apply plugin: 'android-apt'

dependencies {
    compile 'com.github.hotchemi:permissionsdispatcher:2.0.4'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.4'
}
Paxana Non Grata
  • 379
  • 1
  • 7
  • 23

1 Answers1

8

That error message means that you are executing code that was compiled with a later version of Java than that of the executing JVM. I think version 52 corresponds to Java 1.8. So the plugin has likely been compiled with 1.8, and your Gradle environment is executing the plugin with a 1.7-or-earlier JVM.

To fix this, try the following:

  1. Install Java 1.8 JDK on your system. (A JRE would probably suffice)
  2. Set your JAVA_HOME environment variable to point at this 1.8 JDK. Gradle will then use this JDK and all should be well.
EJK
  • 12,332
  • 3
  • 38
  • 55
  • that got it. for people in the future who come to this thread I used http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/ to update it in Ubuntu – Paxana Non Grata Jan 28 '16 at 02:17
  • If issue appears while executing `./gradlew ` command, setting java home in `gradle.properties` file, solves this issue: ```org.gradle.java.home=/usr/java/jdk1.8.0_45/``` – ViliusK Nov 15 '16 at 13:35