错误:任务':app:processDebugResources'

时间:2018-10-11 07:43:20

标签: java android react-native gradle android-gradle

我正在做react-native run-android,并且编译失败

所以我做了./gradlew installDebug --stacktrace来看看我可能在哪里/在做什么。

  

哪个抛出此错误   *异常是:org.gradle.api.tasks.TaskExecutionException:任务':app:processDebugResources'的执行失败。           在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)           在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)           在org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)处           在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)           在org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)           在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)           在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)           在org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)           在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)处           在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)           在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:248)           在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:241)处           在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)处           在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:626)处           在org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)处           在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)           在org.gradle.internal.concurrent.ThreadFactoryImpl $ ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)   造成原因:java.lang.RuntimeException:   com.android.ide.common.process.ProcessException:执行失败   Aapt           在com.android.build.gradle.tasks.ProcessAndroidResources.doFullTask​​Action(ProcessAndroidResources.java:201)           在com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:82)           在org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)           在org.gradle.api.internal.project.taskfactory.IncrementalTask​​Action.doExecute(IncrementalTask​​Action.java:46)           在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:121)           在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:110)处           在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)           ... 29更多原因:com.android.ide.common.process.ProcessException:无法执行   Aapt           在com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:867)           在com.android.build.gradle.tasks.ProcessAndroidResources.doFullTask​​Action(ProcessAndroidResources.java:194)           ... 41更多原因:java.util.concurrent.ExecutionException:   com.android.ide.common.process.ProcessException:执行时出错   进程/Users/anilbhatia/Library/Android/sdk/build-tools/26.0.3/aapt   带有参数{package -f --no-crunch -I   /Users/anilbhatia/Library/Android/sdk/platforms/android-26/android.jar   -M /Users/anilbhatia/Desktop/Crypto-Main/Crypto-frontend/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml   -S / Users / anilbhatia / Desktop / Crypto-Main / Crypto-frontend / android / app / build / intermediates / res / merged / debug -m -J / Users / anilbhatia / Desktop / Crypto-Main / Crypto-frontend / android / app / build /生成/ source / r / debug   -F /Users/anilbhatia/Desktop/Crypto-Main/Crypto-frontend/android/app/build/intermediates/res/resources-debug.ap_   --debug-mode --custom-package com.crypto -0 apk --output-text-symbols / Users / anilbhatia / Desktop / Crypto-Main / Crypto-frontend / android / app / build / intermediates / symbols / debug   --no-version-vectors}           在com.google.common.util.concurrent.AbstractFuture $ Sync.getValue(AbstractFuture.java:299)           在com.google.common.util.concurrent.AbstractFuture $ Sync.get(AbstractFuture.java:286)           在com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)           在com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:865)           ... 42更多原因:com.android.ide.common.process.ProcessException:执行时出错   进程/Users/anilbhatia/Library/Android/sdk/build-tools/26.0.3/aapt   带有参数{package -f --no-crunch -I   /Users/anilbhatia/Library/Android/sdk/platforms/android-26/android.jar   -M /Users/anilbhatia/Desktop/Crypto-Main/Crypto-frontend/android/app/build/intermediates/manifests/full/debug/AndroidManifest.xml   -S / Users / anilbhatia / Desktop / Crypto-Main / Crypto-frontend / android / app / build / intermediates / res / merged / debug -m -J / Users / anilbhatia / Desktop / Crypto-Main / Crypto-frontend / android / app / build /生成/ source / r / debug   -F /Users/anilbhatia/Desktop/Crypto-Main/Crypto-frontend/android/app/build/intermediates/res/resources-debug.ap_   --debug-mode --custom-package com.crypto -0 apk --output-text-symbols / Users / anilbhatia / Desktop / Crypto-Main / Crypto-frontend / android / app / build / intermediates / symbols / debug   --no-version-vectors}           在com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:74)           在com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:49)           在com.android.builder.internal.aapt.AbstractProcessExecutionAapt $ 1.onSuccess(AbstractProcessExecutionAapt.java:78)           在com.android.builder.internal.aapt.AbstractProcessExecutionAapt $ 1.onSuccess(AbstractProcessExecutionAapt.java:74)           在com.google.common.util.concurrent.Futures $ 6.run(Futures.java:1319)           在com.google.common.util.concurrent.MoreExecutors $ DirectExecutor.execute(MoreExecutors.java:457)           在com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)           在com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145)           在com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185)           在com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)           在com.android.build.gradle.internal.process.GradleProcessExecutor $ 1.run(GradleProcessExecutor.java:60)   引起原因:org.gradle.process.internal.ExecException:流程'命令   '/Users/anilbhatia/Library/Android/sdk/build-tools/26.0.3/aapt''   用非零退出值1完成           在org.gradle.process.internal.DefaultExecHandle $ ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:382)           在com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:47)           ...还有9个

坦率地说,这一切对我来说都是陌生的,我不确定如何阅读和理解可能导致错误的问题。

如果要问的不是太多,有人可以帮忙弄清楚我应该在哪里挖掘/什么原因会导致此错误,以便我可以解决此问题?

这是反应性信息

 OS: macOS High Sierra 10.13.4
      CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
      Memory: 29.75 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.12.0 - /usr/local/bin/node
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        Build Tools: 23.0.1, 26.0.2, 26.0.3, 28.0.3
        API Levels: 21, 23, 26, 28
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5014246
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1 
      react-native: 0.56.0 => 0.56.0 
    npmGlobalPackages:
      react-native-cli: 2.0.1

2 个答案:

答案 0 :(得分:0)

尝试在app / build.gradle中将buildTools的版本更改为以下版本

buildToolsVersion“ 21.0.1”

答案 1 :(得分:0)

进入/ android / app / build并删除其中的所有内容。然后尝试运行该应用程序。 如果那行不通,请尝试进入android文件夹并运行“ gradlew clean” 另外,就像上面答案中提到的那样,请确保使用四个SDK来构建React Native应用的SDK与Android Studio中的SDK版本相同。