android gradle失败“ AAPT:错误:资源颜色/ com_facebook_button_background_color_focused_disabled”

ssa*_*kyu 5 android

当我在Android Studio上运行构建时,从“ .gradle / caches / transforms-2 / files-2.1 /”中的项目外链接失败。

我删除了.gradle和.idea文件夹,但无法正常工作。我不知道造成这个问题的原因。

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
Run Code Online (Sandbox Code Playgroud)

/Users/sanggyuchoi/.gradle/caches/transforms-2/files-2.1/3cd774f3c79bd878a921290d3b55239d/res/drawable/com_facebook_button_login_background.xml:26:AAPT:错误:资源颜色/com_facebook_button_background_color_focusrwlhhh/cast_ghr/cast_ghr/castwehdhw/aka_cast7_aka.asp找不到com_facebook_button_background_color_focused_disabled)。

/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.
Run Code Online (Sandbox Code Playgroud)

小智 9

王子的回答应该有效。如果没有,您可以手动设置颜色。执行此操作后,您的应用程序应该正确构建。

<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>
Run Code Online (Sandbox Code Playgroud)


pum*_*nao 5

确保使用最新的Facebook SDK实施

'com.facebook.android:facebook-android-sdk:[5,6)'
Run Code Online (Sandbox Code Playgroud)

  • 实际上,我确实将 SDK 更改为“implementation 'com.facebook.android:facebook-android-sdk:5.4.0'”,并且此错误消失了。非常感谢@pumnao (3认同)