Android Studio 3.0错误:找不到样式属性"@android:attr/windowEnterAnimation" [英] android studio 3.0 error: style attribute '@android:attr/windowEnterAnimation' not found
问题描述
我已经按照步骤迁移到android studio 3.0升级.
I had followed steps of migrating to android studio 3.0 updgradation.
build.gradle
build.gradle
flavorDimensions 'dimensionless'
D:\ R \商人\ projapp \ popuplibrary \ build \ intermediates \ bundles \ debug \ res \ values \ values.xml 错误:(28,5)错误:未找到样式属性'@android:attr/windowEnterAnimation'.
C:\ Users \ user.gradle \ caches \ transforms-1 \ files-1.1 \ appcompat-v7-25.3.1.aar \ f7bb6db2aa55d14683d1c9ddd8d49e03 \ res \ values \ values.xml 错误:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息
错误:任务':popuplibrary:processDebugAndroidTestResources'的执行失败. 无法执行aapt
D:\R\merchant\projapp\popuplibrary\build\intermediates\bundles\debug\res\values\values.xml Error:(28, 5) error: style attribute '@android:attr/windowEnterAnimation' not found.
C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\f7bb6db2aa55d14683d1c9ddd8d49e03\res\values\values.xml Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':popuplibrary:processDebugAndroidTestResources'. Failed to execute aapt
面对相同的问题,但就我而言,这是apccompat库也造成了问题.
Facing same issue but it is apccompat library also creating issue in my case.
未找到样式属性'@android:attr/windowEnterAnimation'
gradlewrapper:
gradlewrapper:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
build.gradle应用程序:
build.gradle app:
productFlavors {
dev {
applicationIdSuffix '.dev'
versionName "1.0"
versionNameSuffix '-dev'
}
qa {
applicationIdSuffix '.qa'
versionName "1.0"
versionNameSuffix '-qa'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
//Butter Knife
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile project(':popuplibrary')
}
推荐答案
AAPT2会引发构建错误.例如,考虑在指定样式属性时是否省略了符号,如下所示:
AAPT2 now throws build errors when you omit or incorrectly place resource reference symbols ( 构建模块时,AAPT2现在会引发以下构建错误: When building the module, AAPT2 now throws the following build error: 另外,考虑从android名称空间访问资源时是否错误地包含了符号,如下所示: Additionally, consider if you incorrectly include the symbol when accessing a resource from the android namespace, as shown below: 构建模块时,AAPT2现在会引发以下构建错误: When building the module, AAPT2 now throws the following build error:
如果您没有犯下半部分所述的错误,那么可能应该归咎于旧版本的appcompat-v7. If you didn't make the mistake described in second half, then perhaps an old version of appcompat-v7 is to blame. 更新到较新的支持库,选择25.4.0或26.1.0或27.0.0.确保您匹配 Update to newer support libraries, pick 25.4.0 or 26.1.0 or 27.0.0. Make sure you match 注意:如果您选择更新到27.0.0之前的版本,则可能会遇到此问题. Note: If you choose to update to something older than 27.0.0 you may run into this issue. 如果由于某些原因您坚持使用25.3.1或更早的版本,则可以停用AAPT2 . If for some reason you're stuck with 25.3.1 or older you can disable AAPT2. 如果在使用AAPT2时遇到问题,可以通过在 If you are experiencing issues while using AAPT2, you can disable it by setting 这篇关于Android Studio 3.0错误:找不到样式属性"@android:attr/windowEnterAnimation"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!错误使用@资源引用符号
现在,当您省略或错误放置资源引用符号(@
)时,
Incorrect use of @ resource reference symbols
@
). For example, consider if you omit the symbol when specifying a style attribute, as shown below:<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
...
<!-- Note the missing '@' symbol when specifying the resource type. -->
<item name="colorPrimary">color/colorPrimary</item>
</style>
ERROR: expected color but got (raw string) color/colorPrimary
...
<!-- When referencing resources from the 'android' namespace, omit the '@' symbol. -->
<item name="@android:windowEnterAnimation"/>
Error: style attribute '@android:attr/windowEnterAnimation' not found
compileSdkVersion
.compileSdkVersion
.
gradle.properties
文件中设置android.enableAapt2=false
并通过从命令行运行./gradlew --stop
来重新启动Gradle守护程序来禁用它.
android.enableAapt2=false
in your gradle.properties
file and restarting the Gradle daemon by running ./gradlew --stop
from the command line.