问题描述
我最近升级到gradle-3.0.0-alpha8,之后在编译时无法解析某些样式.
开发环境:
I recently upgraded to the gradle-3.0.0-alpha8 after which some styles are not resolved at compile time.
Develop envirment:
- IDE:Android Studio 3.0 Bate3
- Gradle构建工具:'com.android.tools.build:gradle:3.0.0-beta3'
- Gradle:gradle-4.1-all.zip
错误信息:
Error:(94, 5) style attribute '@android:attr/windowExitAnimation' not found
Error:(94, 5) style attribute '@android:attr/windowEnterAnimation' not found
在gradle.properties文件中设置android.enableAapt2 = false可以解决此问题.
Setting android.enableAapt2=false in gradle.properties file can solve this isuue.
但是,Instant App需要android.enableAapt2 = true.我该怎么办?
But, Instant App need android.enableAapt2=true. What would i do?
推荐答案
所有问题均已解决.
问题原因:
有两个模块,A_module,B_module.
There are two modules, A_module, B_module.
B_module具有样式:
B_module has a style:
<style name="my_style">
<item
name="@android:windowEnterAnimation">@anim/anim_toast_show</item>
<item
name="@android:windowExitAnimation">@anim/anim_toast_hide</item>
</style>
如果B_module编译(':A_module')
生成或清理,以A_module-> Res-> values-> styles报告错误位置:
If B_module compile(':A_module')
Build or Clean, report a error location in A_module->Res->values->styles:
解决方案:
删除项目名称开头的"@".
Solution:
Removing the "@" at the start of the item name.
<item name="@android:windowEnterAnimation">@anim/anim_toast_show</item>
<item name="@android:windowExitAnimation">@anim/anim_toast_hide</item>
收件人:
<item name="android:windowEnterAnimation">@anim/anim_toast_show</item>
<item name="android:windowExitAnimation">@anim/anim_toast_hide</item>
这篇关于错误:找不到样式属性"@android:attr/windowExitAnimation"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!