Resource android:attr/lStar not found
Unity: All versions | Appodeal SDK: 2.15.4 or newer
The error "AAPT: error: resource android:attr/lStar not found"
happens if your project doesn't support the functionality of API 31,
which is required for androidX libraries used by ad networks.
The error example from Unity Editor Log:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':launcher:processReleaseResources'.
> Android resource linking failed
/Users/user/.gradle/caches/transforms-2/files-2.1/94b0d9b24708e966d39e2a2a45fc8edd/res/values/values.xml:4:5-13:25:
AAPT: error: resource android:attr/lStar not found.
error: failed linking references.
To solve the error:
- Unity 2019 or higher
- Unity 2017 - Unity 2018
Setup Target API level to 32 in File → Build Settings → Player Settings → Other Settings.
These Unity versions don’t support API higher than 30. We recommend updating Unity to 2019.4 or higher to support the highest OS.
Instead, you can do the following:
-
Go to Assets/Plugins/Android and open mainTemplate.gradle file.
-
Exclude from mainTemplate.gradle file the following dependencies:
implementation 'com.my.target:mytarget-sdk:5.15.1'
implementation 'com.yandex.android:mobileads:5.0.0'
implementation 'com.yandex.android:mobmetricalib:4.1.1'
Or add this to your mainTemplate.gradle:
implementation ('androidx.core:core:1.6.0') { force = true }
It may affect your income and the stability of the ad networks. We recommend updating Unity to 2019.4 or higher instead.