Skip to content

UnsupportedClassVersionError: AndroidLocationsProvider (class file version 55.0) #378

@TWiStErRob

Description

@TWiStErRob

Hi, I started sporadically getting this error yesteday:

Run android-actions/setup-android@v2
  env:
    JOB_NAME: AGP 3.5.x on Gradle 6.x (3.5.4) on 6.7.1)
    GRADLE_VERSION: 0.0.0
    JAVA8_HOME: /usr/lib/jvm/temurin-8-jdk-amd64
    JAVA11_HOME: /usr/lib/jvm/temurin-11-jdk-amd64
    JAVA_HOME: /usr/lib/jvm/temurin-8-jdk-amd64
/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager cmdline-tools;7.0
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/prefs/AndroidLocationsProvider has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
/home/runner/work/_actions/android-actions/setup-android/v2/dist/index.js:2348
                error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
                        ^

Error: The process '/usr/local/lib/android/sdk/cmdline-tools/latest/bin/sdkmanager' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/android-actions/setup-android/v2/dist/index.js:2348:25)
    at ExecState.CheckComplete (/home/runner/work/_actions/android-actions/setup-android/v2/dist/index.js:2331:18)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/android-actions/setup-android/v2/dist/index.js:2225:27)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

It happens randomly. I have a big matrix 38 jobs, 23 of them use Java 8, and 2-3 of them randomly chosen of the 23 fail with the above.

My guess is that cmdline-tools:latest was just released with a requirement on Java 11. And this setup-android action is just showing the problem, not causing it. Reported here anyway just in case you know anything, and others are looking at the same problem.

Example fail: https://github.com/TWiStErRob/net.twisterrob.gradle/actions/runs/3939418181/jobs/6862851517
(Note that it is Attempt 2, because the original Attempt 1 execution didn't fail, and because it's on master nothing has changed since Attempt 1 in my code.)

The only other reference to this I found: https://ask.csdn.net/questions/7878632

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions