Warning: The plugin firebase_storage requires Android SDK version 31. One or more plugins require a higher Android SDK version

Viewed 10678

Launching lib\main.dart on sdk gphone x86 in debug mode... Running Gradle task 'assembleDebug'... Warning: The plugin cloud_firestore requires Android SDK version 31. Warning: The plugin firebase_auth requires Android SDK version 31. Warning: The plugin firebase_core requires Android SDK version 31. Warning: The plugin firebase_storage requires Android SDK version 31. One or more plugins require a higher Android SDK version. Fix this issue by adding the following to E:\Flutter App\cash_mimo\android\app\build.gradle: android { compileSdkVersion 31 ... }

Parameter format not correct -

FAILURE: Build failed with an exception.

  • What went wrong: 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.window:window-java:1.0.0-beta04. AAR metadata file: C:\Users\Neno.gradle\caches\transforms-2\files-2.1\1f04460684db0596892f5ab231ef0c5b\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties. 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.window:window:1.0.0-beta04. AAR metadata file: C:\Users\Neno.gradle\caches\transforms-2\files-2.1\4bb066a21b46f5ea31ef8cd7876fc626\jetified-window-1.0.0-beta04\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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 10s Exception: Gradle task assembleDebug failed with exit code 1

4 Answers

your error log has already solution provided :

Fix this issue by adding the following to E:\Flutter App\cash_mimo\android\app\build.gradle: android { compileSdkVersion 31 ... }

The following plugins need CompileSdkVersion 31:

  • cloud_firestore
  • firebase_auth
  • firebase_core
  • firebase_storage

You have two options:

  • Either you change the compilesdkVersion to 31 in your build.gradle file: android/app/build.gradle
  • You downgrade all plugins mentioned above to a version which does not require compilesdkVersion 31

You have to update your compile and target sdk version as 31 on app gradle

If you want to build your app without upgrading target SDK version for some reason, you can downgrade your android gradle version by adding below code to dependencies in: /project_root/build.gradle:

classpath 'com.android.tools.build:gradle:4.0.2'
Related