我正在尝试编写一个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.
这是我的毕业证书的样子:
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一起使用。任何帮助将不胜感激!
答案 0 :(得分:0)
如果我没记错的话,这些样式是在API 24+中添加的。尝试使用最新版本的支持库:
implementation 'com.android.support:appcompat-v7:28.0.0'
还需要更改compileSdkVersion
和buildToolsVersion
:
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
答案 1 :(得分:0)
未找到指定的属性。可能是因为其他库需要使用您正在更改的库进行更新。例如,我很挣扎,因为我的建筑物说
attr?/colorPrimaryVariant not found
所以调查我发现该属性存在于材料 1.2.1 库中,我使用的是材料 1.0.0 库,所以我更新了材料库并且错误消失了。在您的项目中检查类似的内容
快乐编码。