0

I am running:

./gradlew assembleDebug 

from my project folder and getting the error:

* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

I have the following build.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:2.3.3'
        classpath 'com.google.gms:google-services:3.0.0'

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

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
    }
}

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

and I have:

enter image description here

ssk
  • 9,045
  • 26
  • 96
  • 169
  • 1
    on the cli use -D $myJava8SDK with your gradlew exec to run java 8 and get rid of the error – Robert Rowntree Jul 05 '17 at 22:36
  • 1
    I believe that version of Gradle needs Java 8. If you want to stay with Java 7, change to `classpath 'com.android.tools.build:gradle:2.2.2'` Also note that you'll need to use buildToolsVersion lower than 24 in your app level build.gradle, for example: `buildToolsVersion "23.0.3"` The other option is to get fully set up with Java 8. – Daniel Nugent Jul 05 '17 at 22:41
  • 1
    Possible duplicate of [Unsupported major.minor version 52.0 when rendering in Android Studio](https://stackoverflow.com/questions/35937875/unsupported-major-minor-version-52-0-when-rendering-in-android-studio) – Adam S Jul 05 '17 at 22:46

1 Answers1

1

I updated the java in /usr/bin/java from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

and it builds now.

ssk
  • 9,045
  • 26
  • 96
  • 169