当我尝试在React Native中为Android构建APK时,我遇到错误。当我添加依赖项react-native-linear-gradient时,问题开始了。以下是我得到的日志和gradle.build文件。我已经尝试过
- 将sdk版本与构建目标版本build.gradle文件匹配。
- gradle版本较低
-
更改为最新的React本机版本
- 例外是:
org.gradle.api.tasks.TaskExecutionException:任务':app:processReleaseResources'的执行失败。
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:98)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:68)
在org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
在org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
在org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
在org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)处
在org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
在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.execute(DefaultTaskGraphExecuter.java:236)
在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker $ 1.execute(DefaultTaskGraphExecuter.java:228)
在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)处
在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter $ EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)处
在org.gradle.execution.taskgraph.AbstractTaskPlanExecutor $ TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
在org.gradle.execution.taskgraph.AbstractTaskPlanExecutor $ TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
在org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
在org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
在org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
在org.gradle.execution.DefaultBuildExecuter.access $ 000(DefaultBuildExecuter.java:23)
在org.gradle.execution.DefaultBuildExecuter $ 1.proceed(DefaultBuildExecuter.java:43)
在org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
在org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
在org.gradle.initialization.DefaultGradleLauncher $ RunTasksAction.execute(DefaultGradleLauncher.java:230)
在org.gradle.initialization.DefaultGradleLauncher $ RunTasksAction.execute(DefaultGradleLauncher.java:227)
在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
在org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:161)
在org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
在org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:95)
在org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
在org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
在org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
在org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
在org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
在org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
在org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49)
在org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31)
在org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:74)
在org.gradle.launcher.daemon.server.exec.ForwardClientInput $ 2.call(ForwardClientInput.java:72)
在org.gradle.util.Swapper.swap(Swapper.java:38)
在org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.FoundBuildEnvironment.doBuild(BuildBuildEnvironment.java:72)处
在org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
在org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
在org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy $ 1.run(StartBuildOrRespondWithBusy.java:50)
在org.gradle.launcher.daemon.server.DaemonStateCoordinator $ 1.run(DaemonStateCoordinator.java:297)
在org.gradle.internal.concurrent.ExecutorPolicy $ CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
在org.gradle.internal.concurrent.StoppableExecutorImpl $ 1.run(StoppableExecutorImpl.java:46)
引起原因:java.lang.RuntimeException:com.android.ide.common.process.ProcessException:无法执行aapt
在com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:185)
在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.DefaultTaskClassInfoStore $ IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
在org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
在org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.execute(ExecuteActionsTaskExecuter.java:115)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.execute(ExecuteActionsTaskExecuter.java:109)
在org.gradle.internal.Transformers $ 4.transform(Transformers.java:169)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
在org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:109)
在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:90)
...更多70
引起原因:com.android.ide.common.process.ProcessException:无法执行aapt
在com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:873)
在com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:178)
...另外82个
引起原因:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:执行带有参数的'/Users/gautamr/Library/Android/sdk/build-tools/23.0.1/aapt'时出错{package -f --no-crunch -I /Users/gautamr/Library/Android/sdk/platforms/android-23/android.jar -M / Users / gautamr / localDev / latest / Lookplex / android / app / build /中间体/清单/完整/发行版/AndroidManifest.xml -S / Users / gautamr / localDev / latest / Lookplex / android / app / build / intermediates / res / merged / release -m -J / Users / gautamr / localDev / latest / Lookplex / android / app / build /生成/ source / r / release -F /Users/gautamr/localDev/latest/Lookplex/android/app/build/intermediates/res/resources-release.ap_ --custom-package com。 lookplex -0 apk --output-text-symbols / Users / gautamr / localDev / latest / Lookplex / android / app / build / intermediates / symbols / release --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:871)
...另外83个
引起原因:com.android.ide.common.process.ProcessException:执行带有参数{package -f --no-的'/Users/gautamr/Library/Android/sdk/build-tools/23.0.1/aapt'时出错紧缩-I /Users/gautamr/Library/Android/sdk/platforms/android-23/android.jar -M / Users / gautamr / localDev / latest / Lookplex / android / app / build / intermediates / manifests / full / release / AndroidManifest.xml -S / Users / gautamr / localDev / latest / Lookplex / android / app / build / intermediates / res / merged / release -m -J / Users / gautamr / localDev / latest / Lookplex / android / app / build /生成/源/ r /发行版-F /用户/ gautamr / localDev /最新/Lookplex/android/app/build/intermediates/res/resources-release.ap_ --custom-package com.lookplex -0 apk --output-文字符号/ Users / gautamr / localDev / latest / Lookplex / android / app / build / intermediates / symbols / release --no-version-vectors}
在com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:75)
在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:进程'command'/Users/gautamr/Library/Android/sdk/build-tools/23.0.1/aapt''完成,返回值非零
在org.gradle.process.internal.DefaultExecHandle $ ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:369)
在com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:47)
...还有9个
建立失败
总时间:24.062秒
错误命令失败,退出代码为1。
build.gradle文件.............
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
ext {
buildToolsVersion = "23.0.1"
minSdkVersion = 16
compileSdkVersion = 23
targetSdkVersion = 22
supportLibVersion = "23.1.0"
}
subprojects {
project.configurations.all {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
}
}
}
}