[英]Android studio error: “Android resource linking failed. error: failed linking references” with google services API
您好,我正在尝试将此 google play 服务:com.google.android.gms:play-services-vision:18.0.0 添加到我的应用程序中,但它给了我这个错误:
Android resource linking failed
Output: /home/user/java/Project/android-storage-permissions-master/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:460: error: resource android:attr/fontVariationSettings not found.
/home/user/java/Project/android-storage-permissions-master/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:460: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: /home/user/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-linux.jar/9bc4b7764b45753075ab29399a857b9f/aapt2-3.2.0-4818971-linux/aapt2 link -I\
/home/user/Android/Sdk/platforms/android-27/android.jar\
--manifest\
/home/user/java/Project/android-storage-permissions-master/app/build/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml\
-o\
/home/user/java/Project/android-storage-permissions-master/app/build/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_\
-R\
@/home/user/java/Project/android-storage-permissions-master/app/build/intermediates/incremental/processDebugResources/resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
/home/user/java/Project/android-storage-permissions-master/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r\
--custom-package\
com.google.samples.dataprivacy\
-0\
apk\
--output-text-symbols\
/home/user/java/Project/android-storage-permissions-master/app/build/intermediates/symbols/debug/R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-linux Daemon #0
这些是我的 build.gradle(Module.App) 依赖项:
dependencies {
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:support-core-utils:$rootProject.ext.supportLibraryVersion"
implementation "com.google.android.gms:play-services-vision:18.0.0"
implementation "pub.devrel:easypermissions:$rootProject.ext.easypermissionsVersion"
androidTestImplementation("com.android.support.test.espresso:espresso-core:$rootProject.ext.espressoVersion", {
exclude group: "com.android.support", module: "support-annotations"
})
// Dependencies for local unit tests
testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testImplementation "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion"
testImplementation "org.powermock:powermock-module-junit4:$rootProject.ext.powerMockito"
testImplementation "org.powermock:powermock-api-mockito:$rootProject.ext.powerMockito"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
}
在顶级 gradle 文件中,我使用的是 supportLibraryVersion = '27.1.1'。 我尝试将编译 sdk 版本更改为 v28,但它给了我其他错误,因为我的代码的许多其他部分是为 v27 编写的。 现在我使用 com.google.android.gms:play-services-vision:17.0.2 解决了它。 我想知道是否有其他方法可以解决此错误,请继续使用更新版本的 API。
这是因为该库中使用的属性仅在 API 28 中添加。获取 fontVariationSettings 和 ttcIndex 的唯一方法是将您的编译 SDK 版本升级到 28。另一个选择是降级该库的版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.