Android项目打包遇com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

简介: 原文:Android项目打包遇com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details 版权声明:著作权归作者所有。
原文: Android项目打包遇com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

版权声明:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明作者和出处。 https://blog.csdn.net/Jsagacity/article/details/79818024

很多人把Android Studio升级到3.1之后会遇到这样的相关错误:

 java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details

查了网上很多处理都是在项目的gradle.properties中添加下面的配置,再编译就通过了:

android.enableAapt2=false

但是但是在打包的时候又出现这样的问题了,Google、百度了好多遍都没能解决这个问题,最后换种方式查了一下,了解到的解决方法是,在app的build.gradle中添加以下配置:

            aaptOptions.cruncherEnabled = false
            aaptOptions.useNewCruncher = false

添加到如下的位置,编译之后,打包时是成功的。
这里写图片描述

目录
相关文章
|
2月前
|
Android开发 开发者
Error:Could not find com.android.support:appcompat-v7:27.0.2.
Error:Could not find com.android.support:appcompat-v7:27.0.2.
17 0
|
1月前
|
开发工具 Android开发 git
解决Android AAPT: error: resource android:attr/lStar not found. 问题
解决Android AAPT: error: resource android:attr/lStar not found. 问题
48 0
|
3月前
|
Android开发
【Bug】Android resource linking failed和error: failed linking references.
【Bug】Android resource linking failed和error: failed linking references.
|
25天前
|
Android开发 开发者
安卓投屏神器 Scrcpy安 报错ERROR: Could not find any ADB device
使用Scrcpy安卓投屏工具时遇到报错,问题根源是未开启开发者模式。解决步骤:进入设置,点击【关于手机】→连续点击版本号激活开发者模式,然后在【系统设置】→【开发者选项】中开启USB调试。参照此方法后可正常执行。Scrcpy软件下载链接和GitHub页面也已提供。
28 1
|
1月前
|
XML Android开发 数据格式
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class
Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class
23 0
|
2月前
|
API Android开发
List.size() 问题 Android studio: Verbose,Debug,Info,Warn,Error
List.size() 问题 Android studio: Verbose,Debug,Info,Warn,Error
16 0
|
2月前
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
解决Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com
22 5
|
9月前
|
XML Android开发 数据格式
Android Binary XML file line #50: Error inflating class androidx.cardview.widget.CardView 错误
Android Binary XML file line #50: Error inflating class androidx.cardview.widget.CardView 错误
52 0
|
11月前
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: ERROR: APK pat
Unable to determine application id: com.android.tools.idea.run.ApkProvisionException: ERROR: APK pat
276 0
|
12月前
|
数据可视化 开发工具 Android开发
Android Git 拉取代码报错:error: cannot pull with rebase: Your index contains uncommitted changes.
造成原因:在使用Android Studio中Git的Commit Directory 将本地更改的代码保存到本地后,点击commit,发现提交不上去,发现本地有代码,这时候拉取代码,报错:cannot pull with rebase: Your index contains uncommitted changes.表示我的索引有未提交的改变