I'm trying to compile my Flutter app but I get the following problem:
`Execution failed for task ':app:checkDebugAarMetadata'.
Multiple task action failures occurred: 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.media2:media2-session:1.2.0.
When I update the compile SDK to 31, I get this message:
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
I have made changes to some of the gradle files and the warning messages have been removed but now the message below appears:
Running Gradle task 'assembleDebug'...
WARNING: [Processor] Library 'C:\.gradle\caches\modules-2\files-2.1\androidx.media2\media2-session\1.2.0\e110e7db678fbfc107af48fe6110e3cc713f4564\media2-session-1.2.0.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
Example of androidX reference: 'androidx/media2/session/MediaBrowser$Builder'
Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token'
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
W/FlutterActivityAndFragmentDelegate(13937): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Debug service listening on ws://127.0.0.1:54956/S_ZxDICL0Ic=/ws
Syncing files to device AOSP on IA Emulator...
The Notes within the message are highlighted in red so I think this could possibly lead to the root cause/solution.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.