27

I am getting these two error messages when trying to compile:

/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 then opens up v23/values-23.xml with this style:

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

But I don't have that defined anywhere in my app. It is a generated file that is giving me the error. I am pretty stumped on how to fix this issue? Has anyone every encountered this before? How do I fix this?

Project Build File

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()
    }
}

App Build File

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'
The Nomad
  • 7,155
  • 14
  • 65
  • 100
  • linked cordova / ionic question: http://stackoverflow.com/questions/36595119/ionic-android-no-resource-found-that-matches-the-given-name-cardbackgroundcolo/36603653#36603653 – jakub.g Apr 13 '16 at 15:54

7 Answers7

52

compile 'com.facebook.android:facebook-android-sdk:4.+' needs V-23

Change the facebook version SDK to 4.8.0 then it won't use that resource file. Then your code will be up & running/

Jatin Jha
  • 880
  • 9
  • 17
32

I also had this issue. I solved by forcing an older version of the card view library as the issue is with that.

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

The issue was with 23.2.1 of card view, the Facebook SDK uses this library.

sfreeman
  • 466
  • 3
  • 4
  • 3
    Thank you so much for your answer. The other solutions created other issues; except this one, it worked without complications. – Majda Apr 19 '16 at 12:44
  • where do I find this? I don't know where to force the card view library version. Thanks! – weilah Sep 17 '16 at 10:24
  • 1
    @weilah its in the dependencies block of your modules build.gradle file. – sfreeman Sep 25 '16 at 20:27
2

If you are using the "cordova-plugin-facebook4" plugin, please remove the plugin from your project and pull it again (the latest version), then add it back to your project.

At the same time, please check the xml file, which is locate at yourCordovaProject/plugin/cordova-plugin-facebook4/plugin.xml around line No. 64, it must be 4.8.+ :

<framework src="com.facebook.android:facebook-android-sdk:4.8.+"/>

woliveirajr
  • 9,433
  • 1
  • 39
  • 49
infinitysky
  • 166
  • 1
  • 10
0
  1. For a temporary fix I solved my issue changing the project.properties:

vi platforms/android/project.properties

and changed from target=android-22 to target=android-23

  1. For a permanent fix you just need to update the android platform:

cordova platform update android --save

Wils
  • 1,211
  • 17
  • 31
0

For Phonegap Build users, try this. It worked for me.

<plugin spec="https://github.com/jeduan/cordova-plugin-facebook4#aff9a08a86cc6c6a18019f7adc2896ddf97c11cd" source="git" >
ZoM
  • 506
  • 1
  • 6
  • 15
0

my system already had 23 installed. from project panel, Application -> Open module setting (F4) -> application -> Properties tab. I had Compile Sdk Version Android 5.50 (lollipop). So I changed to API 23+ and it worked. So I checked Application build.gradle changed
from compileSdkVersion 21
buildToolsVersion "23.0.3"
to
compileSdkVersion 'android-N'
buildToolsVersion "23.0.3"

so I"m guessing you can simply change compoileSdkVersion to your buildTollVersion.

0

I've fixed it removing the plugin:

 cordova plugin remove cordova-plugin-facebook4

And installing it again from this commit:

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"

Agu Dondo
  • 12,638
  • 7
  • 57
  • 68