我在构建项目的appcompat-v7库中遇到以下错误。
Error:(380, 5) String types not allowed (at 'blue' with value '').
\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.1.1\res\values\values.xml
appcompat-v7 library values.xml文件发生此错误:
<!-- this line --> <style name="Base.TextAppearance.AppCompat.SearchResult" parent="">
<item name="android:textStyle">normal</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textColorHint">?android:textColorHint</item>
</style>
我有最新版本的Android Studio(2.0预览版7)和appcompat-v7库。
build.gradle:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig.with {
applicationId "com.ms.sensors"
minSdkVersion.apiLevel 7
targetSdkVersion.apiLevel 23
versionCode 1
versionName "1.0"
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}
}
android.ndk {
moduleName = "sensorgraph"
cppFlags.add("-Werror")
ldLibs.addAll(["log", "GLESv2", "android"])
stl = "c++_static"
}
android.productFlavors {
create("arm7") {
ndk.abiFilters.add("armeabi-v7a")
}
create("arm8") {
ndk.abiFilters.add("arm64-v8a")
}
create("x86-32") {
ndk.abiFilters.add("x86")
}
// for detailed abiFilter descriptions, refer to "Supported ABIs" @
// https://developer.android.com/ndk/guides/abis.html#sa
// build one including all cpu architectures
create("all")
}
}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
}
我的style.xml:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
答案 0 :(得分:2)
您将空值分配给&#39; blue&#39;
打开你的color.xml然后搜索&#39; blue&#39;并检查你指定的颜色
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue"></color> <!-- must add valid value -->
</resources>