[Solved] AAPT: error: resource android:attr/lStar not found

Recently, I want to try the KTX expansion Library of Android core in the project:

implementation "androidx.core:core-ktx:1.7.0"

After adding dependency, we happily start to use various concise syntax sugars provided by KTX to fly happily~

Once running, wow, I reported an error:

Android resource linking failed /Users/xxx/.gradle/caches/transforms-2/files-
 AAPT: error: resource android:attr/lStar not found.


Solution 1:

If the dependency method is
AndroidX.Core: core-ktx:+
you need to replace it with a specific version

Solution 2:

If the version is  1.7.0, the compilesdkversion of the project is 31, because my project is 30, an error will be reported and changed to 1.6.0 version is good

Read More: