3

更新后通过命令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$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)

也许你有一些想法如何解决它?

4

4 回答 4

5

AGP 中有一个未解决的错误会导致此错误:

TypedefRemover 使用 ASM5,与需要 ASM7 的 JDK 11 源不兼容

该修复程序将在 AGP 7.1-alpha08 和 7.0.1 中提供。


20/08/21 更新:该修复程序已在 com.android.tools.build:gradle:7.0.1

于 2021-08-16T12:35:10.140 回答
0

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

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

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

项目本身还没有更新到JDK11。我们已经开始在一个单独的 git 分支上对其进行研究,但是我们在开始之前就看到了这个问题。

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

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

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

在此处输入图像描述

于 2021-08-11T07:47:10.980 回答
0

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

于 2021-08-11T08:00:06.400 回答
0

更新到 AGP 版本 7.0.1 后问题得到修复

更新您的 build.gradle(项目)

dependencies {

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

}
于 2021-08-25T17:02:34.153 回答