com.android.tools.r8.internal.q8: Unsupported class file version: 60 in android studio

Viewed 3357

I'm trying to import jar in my android studio project

and the jar was compiled with JAVA 16

But when I try to run app, it shows the error:

Caused by: com.android.tools.r8.internal.q8: Unsupported class file version: 60
    at com.android.tools.r8.graph.B0$b.a(SourceFile:106)
    at com.android.tools.r8.internal.T6.a(SourceFile:124)
    at com.android.tools.r8.graph.B0.a(SourceFile:29)
    at com.android.tools.r8.utils.w.a(SourceFile:98)
    at com.android.tools.r8.utils.w.a(SourceFile:95)
Caused by: com.android.tools.r8.internal.q8: Unsupported class file version: 60

    at com.android.tools.r8.graph.B0.b(SourceFile:2)
    at com.android.tools.r8.dex.a$a.a(SourceFile:15)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:321)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
    at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:36)
    at com.android.tools.r8.dex.a$a.a(SourceFile:12)
    at com.android.tools.r8.dex.a$a.a(SourceFile:28)
    at com.android.tools.r8.dex.a.a(SourceFile:76)
    at com.android.tools.r8.dex.a.a(SourceFile:23)
    at com.android.tools.r8.D8.a(D8.java:21)
    at com.android.tools.r8.D8.d(D8.java:11)
    at com.android.tools.r8.D8.b(D8.java:1)
    at com.android.tools.r8.utils.w.a(SourceFile:24)
    ... 40 more
    Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.android.tools.r8.internal.q8: Unsupported class file version: 60
        at com.android.tools.r8.dex.a.a(SourceFile:96)
        ... 45 more
    Caused by: java.util.concurrent.ExecutionException: com.android.tools.r8.internal.q8: Unsupported class file version: 60
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:527)
        at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:88)
        at com.android.tools.r8.utils.V.a(SourceFile:50)
        at com.android.tools.r8.dex.a.a(SourceFile:79)
        ... 45 more
    Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.internal.q8: Unsupported class file version: 60]

    Caused by: java.util.concurrent.ExecutionException: com.android.tools.r8.internal.q8: Unsupported class file version: 60

    Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.internal.q8: Unsupported class file version: 60]

I have tried the following:

  • Change my JDK to JAVA 16

enter image description here

  • Edit my build.gradle to the following: enter image description here

But both cannot resolve my issue.

Also, the source code of jar cannot compile with lower version JDK.

1 Answers

The error is produced by the D8 compiler (converting the class files to DEX), where support for class file version 60 was added in https://r8.googlesource.com/r8/+/96b3725a7170c4e975e08fbd130a642961f46d3a, and released in D8/R8 version 3.1.16-dev. This is included in Canary 11 of Android Studio Bumblebee / AGP 7.1.

You should be able to upgrade to AGP 7.1.0-alpha11 independent of Android Studio. By cahanging to

classpath 'com.android.tools.build:gradle:7.1.0-alpha11'

in you build.gradle file.

Related