迁移到Gradle Plugin 3.0,aapt2构建错误

时间:2017-11-06 11:12:20

标签: android android-studio gradle aapt

迁移到Gradle Plugin 3.0时,默认情况下启用AAPT2。 当我尝试构建项目时,我收到此错误。我知道我可以在gradle.properties中禁用aapt2,但这是一个临时解决方案。有没有人遇到过这个问题?

  

:androiduitableview:processDebugAndroidTestResources   错误:无法创建目录' C:\ sm_build \ Sales Management Android \ androiduitableview \ generated \ source \ r \ androidTest \ debug \ br \ com \ dina \ ui \ test'。

     

无法执行aapt   com.android.ide.common.process.ProcessException:无法执行   哎呀   com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:796)     在   com.android.build.gradle.tasks.ProcessAndroidResources.invokeAaptForSplit(ProcessAndroidResources.java:551)     在   com.android.build.gradle.tasks.ProcessAndroidResources.doFullTask​​Action(ProcessAndroidResources.java:285)     在   com.android.build.gradle.internal.tasks.IncrementalTask​​.taskAction(IncrementalTask​​.java:109)     at sun.reflect.GeneratedMethodAccessor244.invoke(Unknown Source)at   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.DefaultTaskClassInfoStore $ IncrementalTask​​Action.doExecute(DefaultTaskClassInfoStore.java:173)     在   org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)     在   org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore $ StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter $ 1.run(ExecuteActionsTaskExecuter.java:122)     在   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:197)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)     在   org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)     在   org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)     在   org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)     在   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: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:197)     在   org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)     在   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:124)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.access 200 $(DefaultTaskPlanExecutor.java:80)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:105)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker $ 1.execute(DefaultTaskPlanExecutor.java:99)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)     在   org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)     在   org.gradle.execution.taskgraph.DefaultTaskPlanExecutor $ TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)     在   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)引起:   java.util.concurrent.ExecutionException:   java.util.concurrent.ExecutionException:   com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志   详细信息   com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)     在   com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482)     在   com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79)     在   com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:794)     ... 47更多引起:java.util.concurrent.ExecutionException:   com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志   详细信息   com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503)     在   com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:462)     在   com.google.common.util.concurrent.AbstractFuture $ TrustedFuture.get(AbstractFuture.java:79)     在   com.android.builder.internal.aapt.v2.QueueableAapt2.lambda $ makeValidatedPackage $ 1(QueueableAapt2.java:179)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     ... 1更多引起:com.android.tools.aapt2.Aapt2Exception:AAPT2   错误:检查日志以获取详细信息   com.android.builder.png.AaptProcess $ NotifierProcessOutput.handleOutput(AaptProcess.java:454)     在   com.android.builder.png.AaptProcess $ NotifierProcessOutput.err(AaptProcess.java:411)     在   com.android.builder.png.AaptProcess $ ProcessOutputFacade.err(AaptProcess.java:332)     在   com.android.utils.GrabProcessOutput $ 1.run(GrabProcessOutput.java:104)

2 个答案:

答案 0 :(得分:1)

尝试使用--info参数运行gradle build。您可能会发现问题是什么,在我的情况下,它使用的是aaptOptions { additionalParameters '--utf16' }

答案 1 :(得分:0)

这是一个AS错误。从build.gradle更改构建目录时会发生这种情况。我已经打开了一个问题,请加注https://issuetracker.google.com/issues/68936311