androidx.core:core-ktx:+ 编译问题的处理

2,938 阅读1分钟

log如下:

Execution failed for task ':app:processDevelopmentDebugResources'.

> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
.../app/build/intermediates/incremental/mergeDevelopmentDebugResources/merged.dir/values/values.xml:2682: AAPT: error: resource android:attr/lStar not found.

大致的原因是:core-ktx的 alpha02 版本存在错误 解决方式

implementation "androidx.core:core-ktx:1.6.0"` (或任何适合您的版本)

google了一下说还有另一种解决办法(因为第一种方法已经解决,所以没有试第二种):

更改 android/build.gradle 并添加 androidXCore = "1.6.0"

ext {
    buildToolsVersion = "29.0.2"
    minSdkVersion = 21
    compileSdkVersion = 29
    targetSdkVersion = 29
    googlePlayServicesAuthVersion = "16.0.1"
    androidXCore = "1.6.0"    //Add this line
}