簡體   English   中英

不允許的字符串類型(值“”為“藍色”)

[英]String types not allowed (at 'blue' with value '')

我在構建項目的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庫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>

您將空值分配給“藍色”

打開您的color.xml,然后搜索“ blue”並檢查您分配的顏色

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="blue"></color> <!-- must add valid value -->
</resources>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM