Error "The minCompileSdk (31) specified in a error: dependency's AAR metadata ..." in Android apps

When building an Android application, using WorkWithPlus for Native Mobile 7 Upgrade #2.1 (or prior versions) or WorkWithPlus for VideoCall 4 Upgrade #1.4 (or prior), the following error appears:

error:
error: FAILURE: Build failed with an exception.
error:
error: * What went wrong:
error: Execution failed for task ':Bankingly:checkDebugAarMetadata'.
error: > A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
error:    > The minCompileSdk (31) specified in a
error:      dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
error:      is greater than this module's compileSdkVersion (android-30).
error:      Dependency: androidx.work:work-runtime:2.7.0-beta01.

 

This error happens because of a library that WorkWithPlus for Native Mobile distributes to implement some User Controls. This library was updated on 1/09/21, and the new update is not compatible with GeneXus, so the error appears.

Solution

Upgrade your WorkWithPlus for Native Mobile to version WorkWithPlus for Native Mobile 7 Upgrade #2.2 or WorkWithPlus for VideoCall 4 Upgrade #1.5.

You can download them from our Developer Center.

WorkAround

If you can't update your version, you can follow this WA:

Open the file <GENEXUS_INSTALLATION_FOLDER>\Android\Templates\RootProject\build.gradle, and add the line resolutionStrategy.force "androidx.core:core-ktx:1.6.0"  as follows:

ErrorAndroidImg001

Important comment: is possible that other libraries (besides the ones distributed by WorkWithPlus), may use these references too.

For example, if you use One Signal notifications this problem will happen too, and so, the error will appear. In this case, you should also open the  <GENEXUS_INSTALLATION_FOLDER>\Android\Templates\RootProject\build.gradle file and add this line:

resolutionStrategy.force 'androidx.work:work-runtime:2.5.0'

You can read about this problem, in the following GeneXus SAC.