android - Android 中生成的 values-23 文件出错

标签 android android-gradle-plugin

当我尝试构建我的项目时遇到此错误。

Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Home\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

当我点击它时,它会将我带到包含以下代码的生成文件夹的 v-23 值文件。

    <?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="CardView" parent="Base.CardView">
        <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
    </style>
</resources>

这是我的应用程序 gradle 文件

  apply plugin: 'com.android.application'
android {
    compileSdkVersion 22
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.xxxx"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.commit451:inkpageindicator:1.0.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'ch.acra:acra:4.5.0'
    compile 'com.pkmmte.view:circularimageview:1.1'
    compile 'com.google.android.gms:play-services-maps:7.8.0'
    compile 'com.google.android.gms:play-services-location:7.8.0'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.google.android.gms:play-services:7.8.0'
    compile 'com.google.code.gson:gson:2.6.2'

}

当我将 gradle 中的所有内容更改为版本 23 时,此错误消失,但由于我使用的是 http 库,并且它们已从 23 版本中删除,因此我被迫使用 22 版本。我的项目之前运行良好,突然间开始出现此错误。我唯一做的就是安装一个我在其他项目中使用的支持存储库,它也开始在这个项目中出错。 有什么办法可以解决这个错误?

最佳答案

编译'com.facebook.android:facebook-android-sdk:4.+' 需要V-23

在我的例子中,我使用 v-22 所以 我将 Facebook SDK 版本更改为 4.8 编译'com.facebook.android:facebook-android-sdk:4.8.0'

关于android - Android 中生成的 values-23 文件出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35961151/

相关文章:

android - 以编程方式访问 Android 的管理应用程序

android - 如何使列表项可检查?

android - 当抛出 IOException 时,我们是否需要使用 HttpURLConnection 的错误流

安卓工作室 : No build variant found error

android - 如何在 Gradle 中的 buildType 上添加条件 afterEvaluate

java - ImageView不显示图像

java - 在Android应用程序中使用开关按钮

java-native-interface - 使用 Gradle 的 native 二进制支持将静态库包含到共享库中

android - 为什么 JavaDoc 生成 gradle 任务不适用于 Android 插件?

android - 重复的 "IInAppBillingService.aidl"文件 - 库 + 应用程序