java Android Studio失败:生成失败,出现异常,PermittedSubclasses需要ASM9

bvn4nwqk  于 2023-04-19  发布在  Java
关注(0)|答案(1)|浏览(1990)

android studio从电鳗降级为长颈鹿后,无法构建项目。Android Studio抛出异常FAILURE: Build failed with an exception. PermittedSubclasses requires ASM9

FAILURE: Build failed with an exception.

* What went wrong:
Failed to create Jar file C:\Users\Cactus\gradle-7.0.2\caches\jars-8\c5da5d03b7169cae3d2e5669b85ad090\android.jar.
> PermittedSubclasses requires ASM9

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.GradleException: Failed to create Jar file C:\Users\Cactus\gradle-7.0.2\caches\jars-8\c5da5d03b7169cae3d2e5669b85ad090\android.jar.
    at org.gradle.internal.classpath.ClasspathBuilder.jar(ClasspathBuilder.java:55)
    at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.instrument(InstrumentingClasspathFileTransformer.java:137)
    at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.transform(InstrumentingClasspathFileTransformer.java:132)
    at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.transform(InstrumentingClasspathFileTransformer.java:96)
    at org.gradle.internal.classpath.DefaultCachedClasspathTransformer$TransformFile.lambda$schedule$0(DefaultCachedClasspathTransformer.java:274)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9
    at org.objectweb.asm.ClassVisitor.visitPermittedSubclass(ClassVisitor.java:266)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:683)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
    at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.lambda$visitEntries$1(InstrumentingClasspathFileTransformer.java:153)
    at org.gradle.internal.classpath.ClasspathWalker.visitJarContents(ClasspathWalker.java:91)
    at org.gradle.internal.classpath.ClasspathWalker.visit(ClasspathWalker.java:55)
    at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.visitEntries(InstrumentingClasspathFileTransformer.java:148)
    at org.gradle.internal.classpath.InstrumentingClasspathFileTransformer.lambda$instrument$0(InstrumentingClasspathFileTransformer.java:139)
    at org.gradle.internal.classpath.ClasspathBuilder.buildJar(ClasspathBuilder.java:66)
    at org.gradle.internal.classpath.ClasspathBuilder.jar(ClasspathBuilder.java:53)
    ... 7 more

* Get more help at https://help.gradle.org

BUILD FAILED in 9s

我试图清理所有缓存,选择不同的JDK,但我得到了这个错误。

6yt4nkrj

6yt4nkrj1#

我遇到的问题和你的类似,我怀疑可能是Gradel plugin versionGradel version之间的兼容性问题。
我把它改成:Gradel plugin versionGradel version7.3.07.4
然后一切都像以前一样。。
您将找到Gradle设置File > Project Structure...
Android Gradle plugin release notes

相关问题