aapt:error: resource android:attr/lstar not found in Android error occurs when you run the test for release while executing your code. These few steps can help you solve the error.
Change to android x.core:core -ktx:1.6.0
- Open your app/build.gradle file and change this line: androidx.core:core-ktx:+
- Replace it with: android x.core:core -ktx:1.6.0
Let’s say you are using ‘androidx.core:core-ktx:+’. Find the latest version of androidx.core:core-ktx:+ and replace it. The latest version is 1.7.0 and this latest version needs the Android 31 compile SDK. So use the updated version to upgrade the compiled SDK to Android 31.
- Open Android/app project
- Search the text android x.core:core -ktx:+ in all solutions. It is found in some cases in build.gradle file.
- Change from android x.core:core -ktx:+ to android x.core:core -ktx:1.6.0.
Upgrade the compiled SDK to Android 31
If you are using android x.core:core -ktx:+ , then find and upgrade to the latest version with android x.core:core -ktx:1.6.0.
Migrating to Android 31 is not always an easy solution especially since plugins and dependencies needs to support it in particular. However, check your plugins and dependencies and if possible set set static versions instead of ‘latest’. That way you can avoid using alpha/beta releases which could be unstable.
To compile SDK version and target SDK version to 31, add this code snippet in your Android/build.gradle file at the very end;
Configurations.all{resolution strategy}{Force androidx.core:core}
Temporary solutions that might suffice includes:
- Install latest Applovin(11.4) and latest adapters
- Disable auto resolution on build in EDM
- Resolve aars with external dependency manager so it pulls everything
- Delete android x.core-1-x.x (possibly 1.7.0) in all plugins/Android
- Refresh the whole Android platform and your project should not use androidx.core:core:1.7.0-beta02
Recently, the authors of audio players package fixed the issue in the recent upgrade. It has been fixed in audio player version 0.2.0.1. if the issue is related to an audio player simply do an upgrade.
If you received in Android studio when there is a new application, the issue is from BOTH appcompat and core.ktx in dependence.
- Open Open build.gradle
- Look in dependence
- Roll back appcompat to 1.3.0
- Roll back core-ktx to 1.6.0
- Tap ‘Sync now’ at the top right
- Rerun your program, hopefully the error is averted.
These troubleshooting steps will help you solve the “aapt:error: resource android:attr/lstar not found in Android ”