Ошибка привязки ресурса Android - PullRequest
0 голосов
/ 17 июня 2019

Я пытаюсь написать приложение для Android, и в настоящее время, каждый раз, когда я пытаюсь отладить его на устройстве или эмуляторе, приложение не будет собираться, и я получаю сообщение об ошибке «Не удалось связать ресурс Android» вместе с этим:

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.

Вот как выглядит мой gradle:

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'
    }

Кто-нибудь знает, в чем может быть проблема?Я использую Android Gradle Plugin версии 3.4.1 вместе с Gradle версии 5.1.1.Любая помощь будет оценена!

1 Ответ

0 голосов
/ 19 июня 2019

Если я не ошибаюсь, эти стили были добавлены в API 24+.Попробуйте использовать последнюю версию библиотеки поддержки:

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

Также необходимо изменить compileSdkVersion и buildToolsVersion:

compileSdkVersion 28
buildToolsVersion '28.0.3'

Ссылки, которые могут помочь:

Ошибка: ресурс android: style / TextAppearance.Material.Widget.Button.Borderless.Colored не найден

Сборка Gradle: ресурс android: style / TextAppearance.Material не найден

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...