Unsupported major.minor version 52.0

android
circle.yml

#1

I got UnsupportedClassVersionError when CircleCI runs gradle dependencies command. Here is an error that it shows:

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/home/ubuntu/MyProject/app/build.gradle’ line: 1
  • What went wrong:
    A problem occurred evaluating project ‘:app’.

java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 26.931 secs

export TERM="dumb"
if [ -e ./gradlew ]; then ./gradlew dependencies;else gradle dependencies;fi
returned exit code 1

Action failed: gradle dependencies

Here is my configuration in .yml file:

machine:
java:
version: oraclejdk7
environment:
ANDROID_HOME: /usr/local/android-sdk-linux

dependencies:
pre:
- echo y | android update sdk --no-ui --all --filter “tools”
- echo y | android update sdk --no-ui --all --filter “platform-tools”
- echo y | android update sdk --no-ui --all --filter “build-tools”
- echo y | android update sdk --no-ui --all --filter “android-24”
- echo y | android update sdk --no-ui --all --filter “extra-google-m2repository”
- echo y | android update sdk --no-ui --all --filter “extra-google-google_play_services”
- echo y | android update sdk --no-ui --all --filter “extra-android-support”
- echo y | android update sdk --no-ui --all --filter “extra-android-m2repository”
- (./gradlew -version):
timeout: 360
#override:
#- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

checkout:
post:
- git submodule init
- git submodule update
test:
override:
- (./gradlew assemble -PdisablePreDex):
timeout: 360
- cp -r {HOME}/{CIRCLE_PROJECT_REPONAME}/app/build/outputs/apk/ $CIRCLE_ARTIFACTS
- emulator -avd circleci-android22 -no-audio -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
# run tests against the emulator.
- ./gradlew connectedAndroidTest
deployment:
staging:
branch: staging
commands:
- (./gradlew clean assembleStaging crashlyticsUploadDistributionStaging -PdisablePreFex):
timeout: 720

I also put compileOptions in build.gradle

android {

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}

Have anyone faced this problem? Please advice.
Thanks.

FYI: dataBinding is enabled.


#2

I believe this is because Android 24 requires Java 1.8


#3

Hi,
I am having the same issue since updating to the 2.2.0 version of the gradle plugin.
I am not targetting the 24 version of Android, so I don’t know what could cause this issue.

Do you have any ideas?

Thanks!


#4

The 2.2.0 version of the gradle plugin likely requires Java 1.8 as well.


#5

Wow, do you have in hand some kind of guide on how to do this?

Thanks!


#6

Another question, and why does it work on my local machine without having to switch on Java 1.8 support.
At this time, enabling Jack&Jill can be pretty difficult on my project


#7

Fixed this issue by changing to use Java 1.8 on circle server using circle.yml:

`machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
ADB_INSTALL_TIMEOUT: “20"
TERM: “dumb”
_JAVA_OPTIONS: “-Xms1024m -Xmx2048m"
GRADLE_OPTS: '-Dorg.gradle.jvmargs=”-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError”'
java:
version: openjdk8

`


#8