~/myApp/app/build/intermediates/res/merged/debug/values/values.xml:102: error: Error: No resource found that matches the given name: attr 'colorAccent'.找不到与给定名称匹配的资源:attr'colorPrimaryDark'
并且对于colorPrimary
和colorPrimaryDark
。 这是一个基于21+版本的简单项目。
留给后人,看到我values/
:
值/ styles.xml
<resources>
<style name="AppTheme" parent="android:Theme.Material">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
</resources>
值/ colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary">#3F51B5</color>
<color name="primary_dark">#303F9F</color>
<color name="accent">#FF4081</color>
</resources>
的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.dcousens.myapplication"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
.. snip
}
有以这个名字很多问题,但对他们的分辨率碰撞compileSdkVersion
至少21 这已经完成,但错误仍然存在。