AAPT2 error: check logs for details

遇到这个问题我也是比较纳闷、为什么纳闷呢、我来说说我的场景~
本人开发的是多人项目、也算是个老项目、各种SDK、buildTool 相对都比较低,
今天突然接到一个新的任务、单独做个小工具
于是新开了一个工程、此时在引用库的时候都把版本号调到最大(Android Studio 3.3.1 当某些引入库有新版本时会标黄,对于有洁癖的我习惯升级版本)
因为是新项目嘛、倒是顺风顺水非常happy 的完成了~

当我要回归老项目开发时、打开工程编译时出现以下问题:

error: resource style/TextAppearance.Compat.Notification.Info (aka{packageId}.test:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification.Info(aka{packageId}.test:style/TextAppearance.Compat.Notification.Info) not found.
error: resource style/TextAppearance.Compat.Notification.Info(aka{packageId}.test:style/TextAppearance.Compat.Notification.Info) not found.
error: resource
style/TextAppearance.Compat.Notification (aka {packageId}.test:style/TextAppearance.Compat.Notification) not found.
error: resource
style/TextAppearance.Compat.Notification (aka {packageId}.test:style/TextAppearance.Compat.Notification) not found.
error: resource
style/TextAppearance.Compat.Notification (aka {packageId}.test:style/TextAppearance.Compat.Notification) not found.
error: resource
style/TextAppearance.Compat.Notification.Time (aka{packageId}.test:style/TextAppearance.Compat.Notification.Time) not found.
error: resource
style/TextAppearance.Compat.Notification.Time (aka {packageId}.test:style/TextAppearance.Compat.Notification.Time) not found.
error: resource
style/TextAppearance.Compat.Notification.Time (aka {packageId}.test:style/TextAppearance.Compat.Notification.Time) not found.
error: resource
style/TextAppearance.Compat.Notification.Title (aka {packageId}.test:style/TextAppearance.Compat.Notification.Title) not found.
error: resource
style/TextAppearance.Compat.Notification.Title (aka {packageId}.test:style/TextAppearance.Compat.Notification.Title) not found.
error: resource
style/TextAppearance.Compat.Notification.Title (aka {packageId}.test:style/TextAppearance.Compat.Notification.Title) not found.
error: failed linking references.

AAPT2 error: check logs for details

报的是:style/TextAppearance.Compat.Notification.Info not found.
更奇怪的是我的项目里面没有引用到这个sytle呀!!!
经过各种搜索、查找后发现、这个style是sdk里面的、而且是 sdk 27版本以后才有的

27版本之前:
android:textAppearance="@style/TextAppearance.AppCompat.Notification"
27版本之后(包含):
android:textAppearance="@style/TextAppearance.Compat.Notification"

我的工程没用到27版本、他却报了27版本之后的错误、经过一番思考后可能是因为制作新项目引入27版本导致的
于是我到 C:\Users\用户名.gradle\caches 清空、重新打开项目、问题完美的解决了!!

总结:一般报错AAPT2 error: check logs for details,其实问题根源并是不AAPT2、而是你的项目中有某些资源ID找不到引用了,一定要仔细查看错误日志、找到问题根本、如果你的查找方向是AAPT2、那你就入坑了~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值