找不到与给定名称匹配的资源('cardBackgroundColor'与值'?android:attr / colorBackgroundFloating')

时间:2016-03-12 20:49:47

标签: android android-support-library android-cardview build-tools

我在尝试编译时收到这两条错误消息:

/Users/dericw/coding/myApplication/lfdate/android/app/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.2.1/res/values-v23/values-v23.xml
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 '/Users/dericw/Library/Android/sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
然后,Android Studio以这种风格打开v23/values-23.xml

    <style name="CardView" parent="Base.CardView">
        <item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
    </style>

但我没有在我的应用程序中的任何位置定义。这是一个生成的文件,它给了我错误。我很难解决如何解决这个问题?以前有没有人遇到过这个?我该如何解决这个问题?

项目构建文件

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.google.gms:google-services:2.0.0-alpha6'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

应用构建文件

buildscript {
    repositories {
        mavenCentral()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 22
    buildToolsVersion '23.0.2'

    defaultConfig {
        applicationId "com.something.myapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 200
        versionName "1.7.1"
    }

    buildTypes {
        debug {
            versionNameSuffix '-debug'
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
            zipAlignEnabled true
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }

    sourceSets {
        androidTest.setRoot('src/test')
    }
}

repositories {
    mavenCentral()
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
    maven {
        url 'https://maven.fabric.io/public'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
        transitive = true;
    }
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile project(':viewPagerIndicator')
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:cardview-v7:22.2.1'
    compile 'com.android.support:recyclerview-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.mcxiaoke.volley:library:1.+'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'
    compile 'com.google.android.gms:play-services-gcm:8.3.0'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile 'joda-time:joda-time:2.+'
    compile 'com.koushikdutta.async:androidasync:2.+'
    compile 'com.edmodo:rangebar:1.+'
    compile 'org.lucasr.twowayview:twowayview:0.+'
    compile 'com.github.amlcurran.showcaseview:library:5.4.+'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.+'
    compile 'com.getbase:floatingactionbutton:1.+'
    compile 'com.mixpanel.android:mixpanel-android:4.+'
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
    compile 'com.wefika:flowlayout:0.+'
    compile 'com.hudomju:swipe-to-dismiss-undo:1.+'
    compile 'com.soundcloud.android:android-crop:1.0.1@aar'
    compile 'com.squareup.picasso:picasso:2.+'
}

apply plugin: 'com.google.gms.google-services'

7 个答案:

答案 0 :(得分:53)

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

将facebook版SDK更改为4.8.0然后它将不会使用该资源文件。然后你的代码就会出现&amp;运行/

答案 1 :(得分:32)

我也遇到过这个问题。我通过强制使用旧版本的卡片视图库解决了问题。

compile('com.android.support:cardview-v7:23.2.0') {
    force = true
}

问题在于卡片视图的23.2.1,Facebook SDK使用此库。

答案 2 :(得分:2)

如果您使用的是“cordova-plugin-facebook4”插件,请从项目中删除该插件并再次将其拉出(最新版本),然后将其添加回您的项目。

同时,请检查xml文件,该文件位于第64行附近的<telerik:RadComboBox Grid.Row="0" Grid.Column="1" Margin="6,6,6,2" Padding="10,0,0,0" VerticalContentAlignment="Center" ItemsSource="{Binding Source={StaticResource applicationBase}, Path=TaskTypes.TaskTypes}" DisplayMemberPath="Name" SelectedValue="{Binding Path=Task.TaskType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" telerik:StyleManager.Theme="Windows8Touch" FontSize="16" IsEnabled="{Binding Path=IsEnabledState, Mode=TwoWay}"> <telerik:RadComboBox.ItemContainerStyle> <Style TargetType="{x:Type telerik:RadComboBoxItem}"> <Setter Property="IsEnabled"> <Setter.Value> <MultiBinding Converter="{StaticResource ConverterTaskTypeEnabled}"> <Binding Path="."/> <Binding RelativeSource="{RelativeSource AncestorType=Window}" Path="Task.TaskCategoryId" /> </MultiBinding> </Setter.Value> </Setter> </Style> </telerik:RadComboBox.ItemContainerStyle> </telerik:RadComboBox> ,必须是yourCordovaProject/plugin/cordova-plugin-facebook4/plugin.xml

4.8.+

答案 3 :(得分:0)

  1. 对于临时修复,我解决了更改project.properties的问题:
  2.   

    vi platforms / android / project.properties

         

    并从target = android-22更改为target = android-23

    1. 对于永久性修复,您只需更新Android平台:
    2.   

      cordova平台更新android --save

答案 4 :(得分:0)

对于Phonegap Build用户,请尝试此操作。它对我有用。

<plugin spec="https://github.com/jeduan/cordova-plugin-facebook4#aff9a08a86cc6c6a18019f7adc2896ddf97c11cd" source="git" >

答案 5 :(得分:0)

我的系统已经安装了23个。从项目面板,应用程序 - &gt;打开模块设置(F4) - &gt;申请 - &gt;属性选项卡。我有Compile Sdk版Android 5.50(棒棒糖)。所以我改为API 23+并且它有效。 所以我检查了应用程序build.gradle更改了 来自compileSdkVersion 21
    buildToolsVersion“23.0.3”

    compileSdkVersion'android-N'
    buildToolsVersion“23.0.3”

所以我猜你可以简单地将compoileSdkVersion改为你的buildTollVersion。

答案 6 :(得分:0)

我已经修复了删除插件的问题:

 cordova plugin remove cordova-plugin-facebook4

从此提交中再次安装:

cordova plugin add https://github.com/jeduan/cordova-plugin-facebook4\#aff9a08a86cc6c6a18019f7adc2896ddf97c11cd --save --variable APP_ID="YOUR_FB_APP_ID" --variable APP_NAME="YOUR_FB_APP_NAME"