gpt4 book ai didi

java - Android资源链接失败

转载 作者:行者123 更新时间:2023-12-02 04:21:21 25 4
gpt4 key购买 nike

我正在尝试编写一个 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 插件版本 3.4.1 和 Gradle 版本 5.1.1。任何帮助将不胜感激!

最佳答案

如果我没记错的话,这些样式是在 API 24+ 中添加的。尝试使用最新版本的支持库:

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

您还需要更改compileSdkVersionbuildToolsVersion:

compileSdkVersion 28
buildToolsVersion '28.0.3'

可能有帮助的链接:

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

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

关于java - Android资源链接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56635468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com