Kotlin 踩坑日记(五)aapt2 编译 bug

原创 2017年06月01日 09:57:02

前言

常用开发机为Ubuntu 17.04,在升级钱柜娱乐开户 Studio 到3.0.0-Canary2 后,发现之前可以正常编译的钱柜娱乐开户 Kotlin 项目竟然无法编译了,最终发现,是因为aapt2 的问题造成的,并不知道原因,但是估计应该是aapt2的bug吧。。。

Ubuntu下编译钱柜娱乐开户 项目 aapt2 报错

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.lang.NoClassDefFoundError

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:98)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:68)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:60)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:248)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:239)
    at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:114)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:239)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:226)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:120)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:77)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:101)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:95)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:527)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:95)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: com.钱柜娱乐开户.build.gradle.tasks.ResourceException: Error: java.lang.NoClassDefFoundError
    at com.钱柜娱乐开户.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:201)
    at com.钱柜娱乐开户.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:80)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:161)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:132)
    at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.java:115)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.execute(ExecuteActionsTaskExecuter.java:109)
    at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:114)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:109)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:90)
    ... 26 more
Caused by: Error: java.lang.NoClassDefFoundError
    at com.钱柜娱乐开户.ide.common.res2.MergedResourceWriter.postWriteAction(MergedResourceWriter.java:596)
    at com.钱柜娱乐开户.ide.common.res2.MergeWriter.end(MergeWriter.java:45)
    at com.钱柜娱乐开户.ide.common.res2.MergedResourceWriter.end(MergedResourceWriter.java:237)
    at com.钱柜娱乐开户.ide.common.res2.DataMerger.mergeData(DataMerger.java:301)
    at com.钱柜娱乐开户.ide.common.res2.ResourceMerger.mergeData(ResourceMerger.java:412)
    at com.钱柜娱乐开户.build.gradle.tasks.MergeResources.doFullTaskAction(MergeResources.java:194)
    ... 38 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError
    at com.钱柜娱乐开户.ide.common.res2.MergedResourceWriter.postWriteAction(MergedResourceWriter.java:564)
    ... 43 more
Caused by: java.lang.NoClassDefFoundError
    ... 44 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.钱柜娱乐开户.tools.aapt2.Aapt2Jni
    at com.钱柜娱乐开户.builder.internal.aapt.v2.AaptV2Jni.lambda$compile$0(AaptV2Jni.java:90)

使用–stacktrace参数编译后,提示该错误。

解决

在项目gradle.properties文件中添加

钱柜娱乐开户.enableAapt2=false

关闭aapt2的编译,即可

版权声明: 版权声明:本文为博主原创文章,如需转载请在文章中注明“转载”并在文章开头附上本博客链接。

钱柜娱乐开户 Studio升级到3.0,抛出Aapt2Exception异常

问题描述昨天把钱柜娱乐开户 Studio 升级到了3.0。一打开项目或者新建项目都会抛出Aapt2Exception异常。具体log如下: 解决方案最后在万能的stackoverflow上面找到了...
  • l317118524
  • l317118524
  • 2017年10月27日 09:33
  • 2985

钱柜娱乐开户 Studio 3.0 Canary 6 release bug 钱柜娱乐开户.content.res.Resources$NotFoundException

钱柜娱乐开户 Studio 3.0 Canary 6 release bug 钱柜娱乐开户.content.res.Resources$NotFoundException最新的钱柜娱乐开户 St...
  • chengkaizone
  • chengkaizone
  • 2017年07月17日 10:44
  • 953

java.util.concurrent.ExecutionException

jsp开发web后台时配置出错问题
  • yiluxiangqian7715
  • yiluxiangqian7715
  • 2015年04月30日 20:05
  • 12804

studio中运行出现java.util.concurrent.ExecutionException

ExecutionException:
  • gengbaolong
  • gengbaolong
  • 2017年03月28日 20:54
  • 295

钱柜娱乐开户 Studio 3.0预览版本 Error:Gradle: failed to create directory 解决方案

文章目录 - 问题 - 解决方案 - 总结 - 附加 问题体验钱柜娱乐开户 Studio 3.0 预览版,当我创建一个 钱柜娱乐开户项目,在里面写了一个 java 测试类,...
  • shenshizhong
  • shenshizhong
  • 2017年08月24日 19:57
  • 1301

Aapt2异常

今天钱柜娱乐开户 studio提示可以升级到3.0,升级后 gradle也提示升级到3.0.0版本,编译之前正常的项目后报错Error:com.钱柜娱乐开户.tools.aapt2.Aapt2Ex...
  • qq_29760591
  • qq_29760591
  • 2017年10月26日 10:58
  • 4175

java.util.concurrent.ExecutionException:

Error:Execution failed for task ':turingApiExamples:transformClassesWithDexForDebug'. > com.钱柜娱乐开户...
  • a2213502
  • a2213502
  • 2016年07月08日 11:28
  • 4532

解决java.util.concurrent.RejectedExecutionException

前言 昨晚12:00运行自动化测试脚本时遇到了java.util.concurrent.RejectedExecutionException这个异常,从异常名称里很容易分析出是提交的任务被线程池拒绝了...
  • zinss26914
  • zinss26914
  • 2014年08月29日 15:48
  • 29673

钱柜娱乐开户 studio3.0 com.钱柜娱乐开户.tools.aapt2.Aapt2Exception: AAPT2 error

Error:Execution failed for task ':app:mergeDebugResources'.> Error: java.util.concurrent.Exec...
  • yangzongbin
  • yangzongbin
  • 2017年10月26日 18:09
  • 5863

钱柜娱乐开户 Studio3.0之让人懵逼的错误:Error:java.util.concurrent.ExecutionException: com.钱柜娱乐开户.tools.aapt2...

最近将钱柜娱乐开户 Studio从2.3.3升级到3.0.1后,出现了一个莫名其妙的错误,又让人一顿懵。。。 错误信息如下: 只需在工程的gradle.properties文件中添加以下...
  • k_bb_666
  • k_bb_666
  • 2018年01月06日 14:23
  • 364
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Kotlin 踩坑日记(五)aapt2 编译 bug
举报原因:
原因补充:

(最多只允许输入30个字)