1

I am trying to write an Android app and currently, anytime I try to debug it on a device or emulator, the app will not build and I get an error stating "Android resource linking failed" along with this:

Android resource linking failed
error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Inverse not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
error: resource android:style/Widget.Material.Button.Colored not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3038: error: resource android:attr/fontStyle not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3039: error: resource android:attr/font not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3040: error: resource android:attr/fontWeight not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3041: error: resource android:attr/fontVariationSettings not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3042: error: resource android:attr/ttcIndex not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3067: error: resource android:attr/startX not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3070: error: resource android:attr/startY not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3073: error: resource android:attr/endX not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3076: error: resource android:attr/endY not found.
C:\Users\Documents\Android Full Test\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:3084: error: resource android:attr/offset not found.
error: failed linking references.

This is what my gradle looks like:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 'Zebra Technologies Corp:EMDK APIs:22'
    defaultConfig {
        applicationId "com.zebratechnologies.androidfulltest"
        minSdkVersion 22
        targetSdkVersion 22
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    def fileName = "${project.name}_${output.baseName}-${variant.versionName}.apk"
                    outputFileName = new File(output.outputFile.parent, fileName).getName()
                    //  output.outputFileName = new File(output.outputFile.parent,
                    //         output.outputFile.name.replace("app-release-unsigned", "AndroidFullTestL10AW"))
                }
            }
        }
        debug {
            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    def fileName = "${project.name}_${output.baseName}-${variant.versionName}.apk"
                    outputFileName = new File(output.outputFile.parent, fileName).getName()
                    //  output.outputFileName = new File(output.outputFile.parent,
                    //     output.outputFile.name.replace("app-debug", "AndroidFullTestL10AW"))
                }
            }
        }
    }
    productFlavors {
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

    dependencies {

        implementation 'com.android.support:support-v4:22.0.0'
        implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta1'
        compileOnly 'com.google.android.things:androidthings:1.0'
        //    compile 'com.android.support:support-v4:18.0.0'
    }

Does anyone know what the problem could potentially be? I am using Android Gradle Plugin Version 3.4.1 along with Gradle Version 5.1.1. Any help would be appreciated!

jjo
  • 154
  • 2
  • 14

2 Answers2

2

If I'm not mistaken, these styles were added in API 24+. Try to use latest version of support library:

implementation 'com.android.support:appcompat-v7:28.0.0'

Also you need to change compileSdkVersion and buildToolsVersion:

compileSdkVersion 28
buildToolsVersion '28.0.3'

Links that may help:

Error:resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found

Gradle build: resource android:style/TextAppearance.Material not found

Mike Makhovyk
  • 376
  • 3
  • 9
1

The specified attribute is not being found. It may be because others libraries need to be updated with the one you are changing.For example, I struggled because my building said
attr?/colorPrimaryVariant not found
so investigating I found out that property exist in material 1.2.1 lib and I was using material 1.0.0 lib so I updated material lib and the error was gone. Check something like this in your project
Happy coding.

Hanako
  • 1,637
  • 1
  • 13
  • 16