androidreact-nativegradle

How to resolve ':app ' execution failure due to 'androidx.core:core:1.15.0-alpha01' dependency?


I'm encountering an issue when building my Android project. The build fails with the following error:

`Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction An issue was found when checking AAR metadata:

   1.  Dependency 'androidx.core:core:1.15.0-alpha01' requires libraries and applications that
       depend on it to compile against version 35 or later of the
       Android APIs.

       :app is currently compiled against android-34.

       Also, the maximum recommended compile SDK version for Android Gradle
       plugin 8.1.1 is 34.

       Recommended action: Update this project's version of the Android Gradle
       plugin to one that supports 35, then update this project to use
       compileSdk of at least 35.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

`

Additional Info: SDK Tools SDK Platforms

I tried updating the compileSdkVersion to 35 in my build.gradle file, but encountered the following error:

`Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Could not determine the dependencies of null. Failed to find Platform SDK with path: platforms;android-35 `

Additionally, I attempted to force the dependency to an earlier version by adding implementation('androidx.core:core:1.13.1') to my app/build.gradle file, but the error remained the same.


Solution

  • add this code to app/build.gradle

    configurations.all {
        resolutionStrategy {
            force "androidx.core:core:1.13.1"
        }
    }