gpt4 book ai didi

java - Android Studio 资源链接失败

转载 作者:太空宇宙 更新时间:2023-11-03 12:26:21 25 4
gpt4 key购买 nike

我尝试将我的应用程序更新到 sdk 版本 28,但我不断收到此错误:

Android resource linking failed
Output: C:\Users\nick\AndroidStudioProjects\BrowserElement\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2641: error: resource style/Widget.Design.CoordinatorLayout (aka de.test.browserelement:style/Widget.Design.CoordinatorLayout) not found.
error: failed linking references.

Command: C:\Users\nick\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.0-4818971-windows.jar\cbd40259f1851f4cf906e8ce48516057\aapt2-3.2.0-4818971-windows\aapt2.exe link -I\
C:\Users\nick\AppData\Local\Android\Sdk\platforms\android-28\android.jar\
--manifest\
C:\Users\nick\AndroidStudioProjects\BrowserElement\app\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\nick\AndroidStudioProjects\BrowserElement\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@C:\Users\nick\AndroidStudioProjects\BrowserElement\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\nick\AndroidStudioProjects\BrowserElement\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
de.test.browserelement\
-0\
apk\
--output-text-symbols\
C:\Users\nick\AndroidStudioProjects\BrowserElement\app\build\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-windows Daemon #0

我尝试重建应用程序,更新构建工具并单独实现 CoordinatorLayout。我真的不知道为什么会给我这个错误,它适用于 SDK 版本 27。

我的 build.gradle 文件有问题吗?:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "de.test.browserelement"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

对于我正在使用的 CoordinatorLayout,这是 .xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
</android.support.design.widget.CoordinatorLayout>

有人能解决我的问题吗?

最佳答案

error: resource style/Widget.Design.CoordinatorLayout (aka de.test.browserelement:style/Widget.Design.CoordinatorLayout) not found.

转到您的 values.xml 并更改它:

style/Widget.Design.CoordinatorLayout

收件人:

@style/Widget.Support.CoordinatorLayout

例如:

<item name="coordinatorLayoutStyle">@style/Widget.Support.CoordinatorLayout</item>

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

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