解决error: resource android:attr/lStar not found?

时间:2022-06-01 16:31:19

用React Native写的项目,构建Android时报错:

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.

原因时androidx.core:core-ktx导致。解决方案就是把androidx.core:core-ktx指定版本为1.6.0

在应用的build.gradle配置:

configurations.all {
resolutionStrategy {
force 'androidx.core:core-ktx:1.6.0'
}
}

或者在android/build.gradle

implementation 'androidx.core:core:1+

改为

implementation 'androidx.core:core:1.6.0