'android gradle fail "AAPT: error: resource color/com_facebook_button_background_color_focused_disabled"

when I am running build at Android Studio, there are linking failed from the out of project where is in ".gradle/caches/transforms-2/files-2.1/".

I erased .gradle and .idea folder but it is not working. I have no idea what cause of this problem.

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
defaultConfig {
    applicationId "cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 240
    versionName "6.0.16"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    vectorDrawables.useSupportLibrary = true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        lintOptions {
            disable 'MissingTranslation'
        }
    }
}
dexOptions {
    jumboMode true
    javaMaxHeapSize "4g"
}

lintOptions {
    checkReleaseBuilds false
    abortOnError false
}

compileOptions {
    sourceCompatibility java_version
    targetCompatibility java_version
}

aaptOptions {
    cruncherEnabled = false
}

dataBinding {
    enabled = true
}
useLibrary 'org.apache.http.legacy'

}


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

configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
}



Caused by: com.android.builder.internal.aapt.v2.Aapt2Exception: 
Android resource linking failed

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/3cd774f3c79bd878a921290d3b55239d/res/drawable/com_facebook_button_login_background.xml:26: AAPT: error: resource color/com_facebook_button_background_color_focused_disabled (aka cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast:color/com_facebook_button_background_color_focused_disabled) not found.

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/3cd774f3c79bd878a921290d3b55239d/res/drawable/com_facebook_button_login_background.xml:38: AAPT: error: resource color/com_facebook_button_background_color_focused (aka cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast:color/com_facebook_button_background_color_focused) not found.

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/3cd774f3c79bd878a921290d3b55239d/res/drawable/com_facebook_button_login_background.xml:39: AAPT: error: resource color/com_facebook_button_border_color_focused (aka cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast:color/com_facebook_button_border_color_focused) not found.

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/2ba6d3a521b2b781fa16275489758cd4/res/drawable/com_facebook_button_send_background.xml:27: AAPT: error: resource color/com_facebook_button_background_color_focused_disabled (aka cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast:color/com_facebook_button_background_color_focused_disabled) not found.

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/2ba6d3a521b2b781fa16275489758cd4/res/drawable/com_facebook_button_send_background.xml:40: AAPT: error: resource color/com_facebook_button_background_color_focused (aka cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast:color/com_facebook_button_background_color_focused) not found.

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/2ba6d3a521b2b781fa16275489758cd4/res/drawable/com_facebook_button_send_background.xml:41: AAPT: error: resource color/com_facebook_button_border_color_focused (aka cloud.scalabl.httpspg_app_q0nz5d8azjwlxxrweewghhzuexr7rc.anicast:color/com_facebook_button_border_color_focused) not found.


Solution 1:[1]

Make sure to use the latest Facebook SDK implementation

'com.facebook.android:facebook-android-sdk:[5,6)'

Solution 2:[2]

Prince's answer should work. If it does not, you can manually set the colors. Your app should build properly after doing this.

<color name="com_facebook_button_background_color_focused_disabled">#3C5A99</color>
<color name="com_facebook_button_background_color_focused">#3C5A99</color>
<color name="com_facebook_button_border_color_focused">#3C5A99</color>

Solution 3:[3]

I have the solution to this problem.

Follow Step :

  • Clean Project.
  • Re-build Project.
  • Click on the Invalidate/Restart option which in the File option.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pumnao
Solution 2 pyromancer2
Solution 3 Prince Dholakiya