任务 :app:transformClassesWithDexBuilderForDebug in react native 失败:构建失败,出现异常

时间:2021-05-13 14:45:20

标签: react-native

android/app/build.gradle 中的 multiDexEnabled 为真

<块引用>

任务:app:transformClassesWithDexBuilderForDebug com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: 无法处理 /Users/xxxxxx/.gradle/caches/transforms-2/files-2.1/3f59ce583c6cc3a5866ca18087adc6f6/jars/ 在 java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 在 java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在 java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 在 java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) 在 java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481) 在 java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:600) 在 java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678) 在 java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:722) 在 com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:146) 在 com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.transform(DexArchiveBuilderTransform.java:420) 在 com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239) 在 com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235) 在 com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102) 在 com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230) 在 jdk.internal.reflect.GeneratedMethodAccessor376.invoke(未知来源) 在 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.base/java.lang.reflect.Method.invoke(Method.java:567) 在 org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) 在 org.gradle.api.internal.project.taskfactory.IncrementalTask​​Action.doExecute(IncrementalTask​​Action.java:47) 在 org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41) 在 org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:284) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) 在 org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:273) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:258) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:67) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:145) 在 org.gradle.internal.execution.impl.steps.ExecuteStep.execute(ExecuteStep.java:49) 在 org.gradle.internal.execution.impl.steps.CancelExecutionStep.execute(CancelExecutionStep.java:34) 在 org.gradle.internal.execution.impl.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:69) 在 org.gradle.internal.execution.impl.steps.TimeoutStep.execute(TimeoutStep.java:49) 在 org.gradle.internal.execution.impl.steps.CatchExceptionStep.execute(CatchExceptionStep.java:33) 在 org.gradle.internal.execution.impl.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50) 在 org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:43) 在 org.gradle.internal.execution.impl.steps.SnapshotOutputStep.execute(SnapshotOutputStep.java:29) 在 org.gradle.internal.execution.impl.steps.CacheStep.executeWithoutCache(CacheStep.java:134) 在 org.gradle.internal.execution.impl.steps.CacheStep.lambda$execute$3(CacheStep.java:83) 在 java.base/java.util.Optional.orElseGet(Optional.java:369) 在 org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:82) 在 org.gradle.internal.execution.impl.steps.CacheStep.execute(CacheStep.java:36) 在 org.gradle.internal.execution.impl.steps.PrepareCachingStep.execute(PrepareCachingStep.java:33) 在 org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:38) 在 org.gradle.internal.execution.impl.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:23) 在 org.gradle.internal.execution.impl.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96) 在 org.gradle.internal.execution.impl.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89) 在 java.base/java.util.Optional.map(Optional.java:265) 在 org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52) 在 org.gradle.internal.execution.impl.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36) 在 org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:34) 在 org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:91) 在 org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91) 在 org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57) 在 org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119) 在 org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43) 在 org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93) 在 org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45) 在 org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:94) 在 org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:56) 在 org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:55) 在 org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) 在 org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:67) 在 org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) 在 org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) 在 org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101) 在 org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) 在 org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49) 在 org.gradle.execution.plan.LocalTask​​NodeExecutor.execute(LocalTask​​NodeExecutor.java:43) 在 org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355) 在 org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343) 在 org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336) 在 org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322) 在 org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134) 在 org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129) 在 org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202) 在 org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193) 在 org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129) 在 org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) 在 org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) 在 java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 在 java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 在 org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) 在 java.base/java.lang.Thread.run(Thread.java:835) 引起:com.android.builder.dexing.DexArchiveBuilderException:无法处理/Users/saroja/.gradle/caches/transforms-2/files-2.1/3f59ce583c6cc3a5866ca18087adc6f6/jars/classes.jar 在 com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:909) 在 com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$6(DexArchiveBuilderTransform.java:834) 在 java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1447) 在 java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) 在 java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) 在 java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) 在 java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) 在 java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) 引起:com.android.builder.dexing.DexArchiveBuilderException:dexing 时出错。 在 com.android.builder.dexing.D8DexArchiveBuilder.getExceptionToRethrow(D8DexArchiveBuilder.java:124) 在 com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:101) 在 com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:904) ……还有 7 个 引起:com.android.tools.r8.CompilationFailedException: Compilation failed to complete 在 com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:70) 在 com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:43) 在 com.android.tools.r8.D8.run(D8.java:94) 在 com.android.builder.dexing.D8DexArchiveBuilder.convert(D8DexArchiveBuilder.java:99) ... 8个 引起:com.android.tools.r8.utils.AbortException:错误:类型 com.google.android.gms.internal.firebase_messaging.zzb 被引用为来自 com.google.android.gms.internal.firebase_messaging.zzc 的接口。 在 com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:89) 在 com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:60) 在 com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:64) ……还有 11 个

<块引用>

任务 :app:transformClassesWithDexBuilderForDebug 失败

FAILURE:构建失败,出现异常。

  • 出了什么问题: 任务“:app:transformClassesWithDexBuilderForDebug”执行失败。
<块引用>

com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: 无法处理 /User/xxxxx/.gradle/caches/transforms- 2/files-2.1/3f59ce583c6cc3a5866ca18087adc6f6/jars/classes.jar

  • 试试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org

    获得更多帮助

此版本中使用了弃用的 Gradle 功能,使其与 Gradle 6.0 不兼容。 使用“--warning-mode all”显示个别弃用警告

先谢谢了。我尝试了每件事都没有结果。帮帮我吧

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,我尝试将 build.gradle 文件中的以下导入更新为最新版本,但没有用

implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:17.0.0"
implementation "com.google.firebase:firebase-config:17.0.0"
implementation "com.google.firebase:firebase-messaging:18.0.0"

答案 1 :(得分:0)

我在这里找到了解决方案https://github.com/zo0r/react-native-push-notification/issues/1979

更新 react-native-push-notification 依赖到 7.3.1