gradle NestMember需要ASM7

disho6za  于 2022-11-14  发布在  其他
关注(0)|答案(5)|浏览(503)

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

* What went wrong:

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

·运行./gradlew dependencyReport。修复了所有asm版本为7的问题。
·在文件中搜索asm文本--没有发现任何可疑的内容。
·在所有build.gradle文件中添加了implementation "org.ow2.asm:asm:7.0",以防万一。
·运行带有scan标志的./gradlew lintFooDebug --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$1.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$2.run(ExecuteActionsTaskExecuter.java:498)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.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$1(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.access$300(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$000(ExecuteStep.java:37)  
        at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)  
        at org.gradle.internal.execution.steps.ExecuteStep$1.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$3.execute(DefaultBuildOperationRunner.java:75)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.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$2(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$0(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$2(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$0(AssignWorkspaceStep.java:40)    
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.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$1.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$1.executeTask(EventFiringTaskExecuter.java:77)   
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)  
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.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$3.execute(DefaultBuildOperationRunner.java:75)    
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.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$2(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$0(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$1.run(ManagedExecutorImpl.java:48)    
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

也许你有办法修好它?

yrwegjxp

yrwegjxp1#

AGP中存在导致此错误的未决错误:
TypedefRemover uses ASM5 and is incompatible with JDK 11 sources that require ASM7
AGP 7.1-alpha 08和7.0.1中将提供此修复程序。

2008年8月21日更新:com.android.tools.build:gradle:7.0.1中已提供修复程序

yvt65v4c

yvt65v4c2#

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

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

我们没有在项目中直接使用ASM,因此这是我们的一个依赖项的问题。
项目本身还没有更新到JDK11。我们已经开始在一个单独的git分支上研究它,但是我们在开始之前就看到了这个问题。
不久之前,我们已经更新了Kotlin版本和一些其他的依赖版本。
对我们来说,变通的解决方案相当简单,如果过一段时间有点令人厌倦的话。
选择构建窗口中显示Build: failed的最顶端条目将更新右侧的详细信息窗口,这将显示一个Run with --stacktrace选项。选择此选项将每次成功地重建我们的项目。我很想知道为什么会出现这种情况,但还没有时间彻底调查。

gj3fmq9x

gj3fmq9x3#

这不是常见的Java依赖关系问题(至少不是Java项目本身的问题),而是AGP问题。因此,您不必更新Java项目依赖关系...而是运行Gradle(和Android Gradle插件)的JVM。该问题不会遗漏有关插件版本的任何信息,您可能正在使用该插件进行构建...当前版本为:7.0.0 .

rm5edbpk

rm5edbpk4#

更新到AGP版本7.0.1后,问题得到修复
更新您的build.gradle(项目)

dependencies {

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

}
ogq8wdun

ogq8wdun5#

我在执行以下操作后消除了此错误
构建清理
生成项目

相关问题