'How to resolve ionic Cordova & Angular "minCompileSdk (31) specified in a dependency's AAR metadata"

As a lot of other people have the following error. I got it but I'm using Ionic Cordova.

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-30).
     Dependency: androidx.appcompat:appcompat:1.6.0-alpha01.
     AAR metadata file: C:\Users\ultrastark\.gradle\caches\transforms-3\3dadc1407007dc7f031b18b2d33f4031\transformed\appcompat-1.6.0-alpha01\META-INF\com\android\build\gradle\aar-metadata.properties.

I now I have to change the both of them to the following version

implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'

But I cannot do that through Android studio, Since I'm using Vs-Code, Ionic & Cordova, or can I?

What could be the way to change those version within Cordova or Ionic?

Additional information

I'm running this following

  • ionic cordova platform remove android && ionic cordova platform add android && ionic cordova prepare android && ionic cordova run android --livereload --device --verbose

Using the following version of cordova-android: 10.1.2

I cannot install the version 31 since it isn't supported yet by cordova



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source