将AS更新为3.1.2后,我面临很多问题,其中一个是
Execution failed for task ':app:transformClassesWithShrinkResForDebug
。
org.gradle.api.tasks.TaskExecutionException:任务':app:transformClassesWithShrinkResForDebug'执行失败。在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) 在 org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) 在 org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) 在 org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) 在 org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59) 在 org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101) 在 org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44) 在 org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91) 在 org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62) 在 org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59) 在 org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) 在 org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 在 org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) 在 org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.run(DefaultTaskGraphExecuter.java:256) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在 org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249) 在 org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238) 在 org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) 在 org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access 200 $(DefaultTaskPlanExecutor.java:79) 在 org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:104) 在 org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:98) 在 org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663) 在 org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597) 在 org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) 在 org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 在 org.gradle.internal.concurrent.ManagedExecutorImpl $ 1.run(ManagedExecutorImpl.java:46) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617) 在 org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 在java.lang.Thread.run(Thread.java:745)`引起: org.gradle.tooling.BuildException at com.android.build.gradle.internal.scope.BuildElements $ ExecutorBasedScheduler $ $改造2.invoke(BuildElements.kt:133) 在 com.android.build.gradle.internal.scope.BuildElements $ ExecutorBasedScheduler $ $改造2.invoke(BuildElements.kt:110) 在 kotlin.sequences.SequencesKt ___ SequencesKt $ onEach $ 1.invoke(_Sequences.kt:1260) 在 kotlin.sequences.TransformingSequence $ $迭代器1.next(Sequences.kt:149) 在 kotlin.sequences.FilteringSequence $ $迭代器1.calcNext(Sequences.kt:109) 在 kotlin.sequences.FilteringSequence $ $迭代器1.hasNext(Sequences.kt:133) 在 kotlin.sequences.TransformingSequence $ $迭代器1.hasNext(Sequences.kt:153) 在 kotlin.sequences.SequencesKt ___ SequencesKt.toCollection(_Sequences.kt:633) 在 kotlin.sequences.SequencesKt ___ SequencesKt.toMutableList(_Sequences.kt:663) 在 kotlin.sequences.SequencesKt ___ SequencesKt.toList(_Sequences.kt:654) 在 com.android.build.gradle.internal.scope.BuildElements $ ExecutorBasedScheduler.transform(BuildElements.kt:140) 在 com.android.build.gradle.internal.scope.BuildElements $ ExecutorBasedScheduler.into(BuildElements.kt:115) 在 com.android.build.gradle.internal.scope.BuildElementActionScheduler.into(BuildElementActionScheduler.kt:32) 在 com.android.build.gradle.internal.transforms.ShrinkResourcesTransform.transform(ShrinkResourcesTransform.java:241) 在 com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:221) 在 com.android.build.gradle.internal.pipeline.TransformTask $ 2.call(TransformTask.java:217) 在 com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102) 在 com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:498)at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50) 在 org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) 在 org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:124) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor $ RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) 在 org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95) ... 33更多引起:java.lang.NullPointerException at com.android.build.gradle.tasks.ResourceUsageAnalyzer $ UsageVisitor.handleCodeConstant(ResourceUsageAnalyzer.java:1721) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer $ UsageVisitor.access $ 000(ResourceUsageAnalyzer.java:1602) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer $ UsageVisitor $ 1.visitLdcInsn(ResourceUsageAnalyzer.java:1618) 在org.objectweb.asm.ClassReader.a(未知来源)at org.objectweb.asm.ClassReader.b(未知来源)at org.objectweb.asm.ClassReader.accept(未知来源)at org.objectweb.asm.ClassReader.accept(未知来源)at com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1417) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1381) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1375) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1375) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1375) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1375) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1375) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.recordClassUsages(ResourceUsageAnalyzer.java:1375) 在 com.android.build.gradle.tasks.ResourceUsageAnalyzer.analyze(ResourceUsageAnalyzer.java:272) 在 com.android.build.gradle.internal.transforms.ShrinkResourcesTransform.splitAction(ShrinkResourcesTransform.java:306) 在 com.android.build.gradle.internal.transforms.ShrinkResourcesTransform.lambda $ $变换0(ShrinkResourcesTransform.java:239) 在 com.android.build.gradle.internal.scope.BuildElements $ ExecutorBasedScheduler $变换$$内嵌$ $的forEach拉姆达$ 1.call(BuildElements.kt:121) 在 com.android.build.gradle.internal.scope.BuildElements $ ExecutorBasedScheduler $变换$$内嵌$ $的forEach拉姆达$ 1.call(BuildElements.kt:110) 在 java.util.concurrent.ForkJoinTask $ AdaptedCallable.exec(ForkJoinTask.java:1424) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) 在 java.util.concurrent.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1056) 在 java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) 在 java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
答案 0 :(得分:0)
请检查是否在资源文件夹中添加了任何.9批处理图像文件(例如abc.9.png),这不是实际的.9批处理图像。 包括有效的.9批处理图片。