Hi everyone,
I'm encountering a Gradle build error that I haven't been able to resolve. Here's the error message:
Code
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:mergeDebugResources
> Task :app:processDebugMainManifest
> Task :app:processDebugManifest
> Task :app:processApplicationManifestDebugForBundle
> Task :app:mergeDebugShaders
> Task :app:compileDebugShaders NO-SOURCE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:checkDebugDuplicateClasses
> Task :app:generateDebugBuildConfig
> Task :app:javaPreCompileDebug
> Task :app:checkDebugAarMetadata FAILED
> Task :app:processDebugManifestForPackage
> Task :app:bundleDebugResources FAILED
> Task :app:mergeDebugJavaResource
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-29).
Dependency: androidx.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\Admin\.gradle\caches\transforms-3\f052799bd1514fad727c14656fc8e64d\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:bundleDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2ProcessResourcesRunnable
> Android resource linking failed
ERROR:C:\Users\Admin\.gradle\caches\transforms-3\03a1b8ca0380c77bbfab545663bdd5a6\transformed\core-1.8.0\res\values\values.xml:104:5-113:25: AAPT: error: resource android:attr/lStar not found.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
16 actionable tasks: 16 executed
Display More
I’m using Java 17.0.15 and Android Studio 2024.3.2, and my Gradle version is 7.5
I'm getting this error because my project is using compileSdkVersion 29, but the library androidx.appcompat:appcompat:1.4.1 requires at least compileSdkVersion 31.
🔧 How do I Fix It?:
I need to change my compileSdkVersion and targetSdkVersion to at least 31.