22

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 build tools : 'com.android.tools.build:gradle:3.0.0-beta3'
  • Gradle :gradle-4.1-all.zip

Error info:

    Error:(94, 5) style attribute '@android:attr/windowExitAnimation' not found
    Error:(94, 5) style attribute '@android:attr/windowEnterAnimation' not found

Setting android.enableAapt2=false in gradle.properties file can solve this isuue.

But, Instant App need android.enableAapt2=true. What would i do?

Yu Zhang
  • 1,202
  • 1
  • 11
  • 16
  • https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html – IntelliJ Amiya Aug 30 '17 at 06:30
  • Can you try it with Android Studio Beta 2? Because Beta 3 version was removed https://androidstudio.googleblog.com/2017/08/android-studio-30-beta-3-is-now.html (with android.enableAapt2) – Julia K Aug 30 '17 at 23:41
  • I found a similar issue reported in public tracker https://issuetracker.google.com/issues/65036100 – Julia K Aug 30 '17 at 23:42

3 Answers3

71

All the problem was solved already.

Cause of the problem:

There are two modules, A_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>

If B_module compile(':A_module')
Build or Clean, report a error location in A_module->Res->values->styles:

Error:(94, 5) style attribute '@android:attr/windowExitAnimation' not found
Error:(94, 5) style attribute '@android:attr/windowEnterAnimation' not found

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>

to:

<item name="android:windowEnterAnimation">@anim/anim_toast_show</item>
<item name="android:windowExitAnimation">@anim/anim_toast_hide</item>
Yu Zhang
  • 1,202
  • 1
  • 11
  • 16
5

Setting android.enableAapt2=false in the gradle.properties file fixes this issue. See the Stack Overflow question I linked.

It will help you!

tech2017
  • 1,806
  • 1
  • 13
  • 15
3

Removing a custom attribute

I got a similar error when I deleted an attribute for a custom view. The reason the error came up was that I still had xml references to it in my project.

Pressing Ctrl + Shift + F to search the entire project for the offending attribute and then removing all references to it solved the problem.

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393