NestMember 需要 ASM7

NestMember requires ASM7

更新到 Java 11 后,在 Android Studio 中通过 ./gradlew lintFooDebug 命令出错。

* What went wrong:

Execution failed for task ‘foo:syncDebugLibJars'.
> NestMember requires ASM7

• 运行 ./gradlew dependencyReport。将所有 asm 版本修复为 7.

• 在文件中搜索 asm 文本 - 未发现任何可疑内容。

• 已将 implementation "org.ow2.asm:asm:7.0" 添加到所有 build.gradle 文件。以防万一

• 运行 ./gradlew lintFooDebug --scan 带有 scan 标志以获取详细信息:

    Caused by: java.lang.UnsupportedOperationException: NestMember requires ASM7    
at org.objectweb.asm.ClassVisitor.visitNestMember(ClassVisitor.java:251)    
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:663)   
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:394)   
        at com.android.builder.packaging.TypedefRemover.rewriteOuterClass(TypedefRemover.java:239)  
        at com.android.builder.packaging.TypedefRemover.filter(TypedefRemover.java:139) 
        at com.android.builder.packaging.JarFlinger.addDirectory(JarFlinger.java:107)   
        at com.android.build.gradle.internal.tasks.LibraryAarJarsTask$Companion.mergeInputsToLocation(LibraryAarJarsTask.kt:251)    
        at com.android.build.gradle.internal.tasks.LibraryAarJarsTask$Companion.mergeInputs(LibraryAarJarsTask.kt:166)  
        at com.android.build.gradle.internal.tasks.LibraryAarJarsTask.doTaskAction(LibraryAarJarsTask.kt:120)   
        at com.android.build.gradle.internal.tasks.NonIncrementalTask$taskAction$$inlined$recordTaskAction.invoke(BaseTask.kt:63) 
        at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)    
        at com.android.build.gradle.internal.tasks.NonIncrementalTask.taskAction(NonIncrementalTask.kt:94)  
        at jdk.internal.reflect.GeneratedMethodAccessor1778.invoke(Unknown Source)  
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)   
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58) 
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)   
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)   
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.run(ExecuteActionsTaskExecuter.java:498)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:29)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:26)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:75)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) 
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)  
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)  
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run(DefaultBuildOperationExecutor.java:71) 
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)    
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)  
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:483)    
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:466)   
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access0(ExecuteActionsTaskExecuter.java:105)   
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:270) 
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:248)    
        at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:83) 
        at org.gradle.internal.execution.steps.ExecuteStep.access[=11=]0(ExecuteStep.java:37)  
        at org.gradle.internal.execution.steps.ExecuteStep.call(ExecuteStep.java:50)  
        at org.gradle.internal.execution.steps.ExecuteStep.call(ExecuteStep.java:47)  
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:75)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) 
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)  
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62) 
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call(DefaultBuildOperationExecutor.java:76)    
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)   
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76) 
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:47) 
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:37) 
        at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68) 
        at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38) 
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:50) 
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36) 
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41) 
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)   
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55) 
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51) 
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29) 
        at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:54)   
        at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:35)   
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)   
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)   
        at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:174)  
        at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:74)   
        at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:45)   
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:40) 
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:29) 
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36) 
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22) 
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:99)    
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute[=11=](SkipUpToDateStep.java:92)  
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)   
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)   
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:84)   
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:41)   
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)    
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)    
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:91) 
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49) 
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78) 
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:49) 
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:105)  
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)   
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute(SkipEmptyWorkStep.java:86)    
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86) 
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32) 
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)  
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)   
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)   
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute[=11=](AssignWorkspaceStep.java:40)    
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.withWorkspace(ExecuteActionsTaskExecuter.java:283)    
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40) 
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30) 
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37) 
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27) 
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:49)   
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:35)   
        at org.gradle.internal.execution.impl.DefaultExecutionEngine.execute(DefaultExecutionEngine.java:76)  
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)   
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)  
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)    
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)   
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)   
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) 
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)   
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)   
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.executeTask(EventFiringTaskExecuter.java:77)   
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.call(EventFiringTaskExecuter.java:55)  
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.call(EventFiringTaskExecuter.java:52)  
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:75)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) 
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)  
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62) 
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call(DefaultBuildOperationExecutor.java:76)    
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)   
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76) 
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) 
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)   
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)   
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)   
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)  
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)  
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run[=11=](DefaultPlanExecutor.java:127)  
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)   
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)   
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)   
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)   
        at org.gradle.internal.concurrent.ManagedExecutorImpl.run(ManagedExecutorImpl.java:48)    
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

也许您有一些解决方法?

最近在我的项目中看到了类似的错误。

Execution failed for task ':app:dexBuilderProdDebug'.
> java.lang.UnsupportedOperationException: NestHost requires ASM7

我们不直接在项目中使用 ASM,因此这是我们的依赖项之一的一些问题。

项目本身还没有更新到JDK11。我们已经开始在一个单独的 git 分支上调查它,但我们在开始之前就看到了这个问题。

不久前我们更新了 kotlin 版本和一些其他依赖版本。

我们的变通解决方案相当简单,如果一段时间后有点烦人的话。

选择显示 Build: failed 的构建 window 中的最顶部条目会将详细信息 window 更新到右侧,这将显示 Run with --stacktrace选项。选择此项将每次都成功地重建我们的项目。我很想知道为什么会这样,但还没有时间彻底调查。

这不是常见的 Java 依赖性问题(至少不是 Java 项目本身),而是一个 AGP 问题。因此,您不必更新 Java 项目依赖项...但 Gradle(和 Android Gradle 插件)运行的 JVM。这个问题并没有透露关于插件版本的信息,您可能正在构建它......当前版本为:7.0.0.

AGP 中存在导致此错误的未解决错误:

TypedefRemover uses ASM5 and is incompatible with JDK 11 sources that require ASM7

修复将在 AGP 7.1-alpha08 和 7.0.1 中发布。


2021 年 8 月 20 日更新: 该修复程序已在 com.android.tools.build:gradle:7.0.1

更新到 AGP 版本 7.0.1 后问题已得到解决

更新您的build.gradle(项目)

dependencies {

    classpath "com.android.tools.build:gradle:7.0.1"

}