简体   繁体   中英

Android resource linking failed errors

Trying to run a project that was previously working fine. I haven't changed anything on this project in weeks. Suddenly when I try to run it I get a pile of errors. I've cleaned the project, Invalidated the cache, reinstalled Android studio, nothing seems to correct it.

Was able to get the gradle sync to finish by reinstalling the sdk in a different location but the resource linking promblems persist.

AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\myusername\\Desktop\\RESTORED-BOMI_ACRM\\app\\src\\main\\res\\values-v21\\styles.xml","position":{"startLine":2,"startColumn":4,"startOffset":20,"endLine":6,"endColumn":12,"endOffset":242}}],"original":"C:\\Users\\myusername\\Desktop\\RESTORED-BOMI_ACRM\\app\\src\\main\\res\\values-v21\\styles.xml:3:5-7:13: AAPT: error: style attribute 'android:attr/windowDrawsSystemBarBackgrounds' not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml","position":{"startLine":1500,"startColumn":4,"startOffset":84224,"endLine":1504,"endColumn":12,"endOffset":84495}}],"original":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml:1501:5-1505:13: AAPT: error: style attribute 'android:attr/textAllCaps' not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml","position":{"startLine":1529,"startColumn":4,"startOffset":85874,"endLine":1534,"endColumn":12,"endOffset":86288}}],"original":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml:1530:5-1535:13: AAPT: error: resource android:attr/textColorHighlightInverse not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml","position":{"startLine":1529,"startColumn":4,"startOffset":85874,"endLine":1534,"endColumn":12,"endOffset":86288}}],"original":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml:1530:5-1535:13: AAPT: error: resource android:attr/textColorLinkInverse not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml","position":{"startLine":1539,"startColumn":4,"startOffset":86519,"endLine":1544,"endColumn":12,"endOffset":86939}}],"original":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml:1540:5-1545:13: AAPT: error: resource android:attr/textColorHighlightInverse not found.\n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml","position":{"startLine":1539,"startColumn":4,"startOffset":86519,"endLine":1544,"endColumn":12,"endOffset":86939}}],"original":"C:\\Users\\myusername\\.gradle\\caches\\transforms-2\\files-2.1\\65bf90c48b89b41813cde0a04f1b73cc\\appcompat-v7-28.0.0\\res\\values\\values.xml:1540:5-1545:13: AAPT: error: resource android:attr/textColorLinkInverse not found.\n    ","tool":"AAPT"}

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\myusername\Desktop\RESTORED-BOMI_ACRM\app\src\main\res\values-v21\styles.xml:3:5-7:13: AAPT: error: style attribute 'android:attr/windowDrawsSystemBarBackgrounds' not found.
         
     C:\Users\myusername\.gradle\caches\transforms-2\files-2.1\65bf90c48b89b41813cde0a04f1b73cc\appcompat-v7-28.0.0\res\values\values.xml:1501:5-1505:13: AAPT: error: style attribute 'android:attr/textAllCaps' not found.
         
     C:\Users\myusername\.gradle\caches\transforms-2\files-2.1\65bf90c48b89b41813cde0a04f1b73cc\appcompat-v7-28.0.0\res\values\values.xml:1530:5-1535:13: AAPT: error: resource android:attr/textColorHighlightInverse not found.
         
     C:\Users\myusername\.gradle\caches\transforms-2\files-2.1\65bf90c48b89b41813cde0a04f1b73cc\appcompat-v7-28.0.0\res\values\values.xml:1530:5-1535:13: AAPT: error: resource android:attr/textColorLinkInverse not found.
         
     C:\Users\myusername\.gradle\caches\transforms-2\files-2.1\65bf90c48b89b41813cde0a04f1b73cc\appcompat-v7-28.0.0\res\values\values.xml:1540:5-1545:13: AAPT: error: resource android:attr/textColorHighlightInverse not found.
         
     C:\Users\myusername\.gradle\caches\transforms-2\files-2.1\65bf90c48b89b41813cde0a04f1b73cc\appcompat-v7-28.0.0\res\values\values.xml:1540:5-1545:13: AAPT: error: resource android:attr/textColorLinkInverse not found.
         

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
55 actionable tasks: 4 executed, 51 up-to-date

This is my build.Gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '29.0.2'
    defaultConfig {
        applicationId "com.myappname"
        minSdkVersion 23
        targetSdkVersion 26
        versionCode 2
        versionName '2.0.1'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    useLibrary 'org.apache.http.legacy'
    productFlavors {
    }
}
repositories {
    flatDir {
        dirs 'libs' }
    maven { url 'https://maven.google.com' }
    maven { url 'https://jitpack.io' }
}

dependencies {
    testImplementation 'junit:junit:4.12'
    api fileTree(include: ['*.jar'], dir: 'libs')
    api('com.mikepenz:materialdrawer:5.1.6@aar') {
        transitive = true
    }
    api('com.mikepenz:crossfadedrawerlayout:0.3.3@aar') {
        transitive = true
    }
    // https://mvnrepository.com/artifact/com.android.volley/volley
    api 'com.android.volley:volley:1.2.0'
    api fileTree(include: ['*.jar'], dir: 'libs')
    api 'com.android.support.constraint:constraint-layout:2.0.4'
    //noinspection GradleCompatible
    api 'com.android.support:preference-v7:26.1.0'
    api files('libs/gson-2.7.jar')
    api project(':aFileDialog')
    api 'com.android.support:appcompat-v7:26.1.0'
    api 'com.android.support:design:26.1.0'
    api 'com.google.android.gms:play-services-appindexing:9.8.0'
    api 'com.android.support:support-v4:26.1.0'
    api 'com.android.support:recyclerview-v7:26.1.0'
    api 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
    implementation 'com.github.pratikbutani:MultiSelectSpinner:08d324c987'
    implementation 'com.github.chrisbanes:PhotoView:2.0.0'

again this ran perfectly fine before. I haven't changed anything in weeks. I've even tried migrating to AndroidX and it still throws the same gradle errors.

Check to see if in any of your layouts you have put

android:attr/textAllCaps

Instead of

android:?attr/textAllCaps

I had to add the following to my projects build.gradle

   subprojects {
        afterEvaluate {
            project ->
                if (project.hasProperty("android")) {
                    android {
                        compileSdkVersion = 26
                        buildToolsVersion = '29.0.2'
                    }
                }
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM