skip to Main Content

im trying to add the cloud_firestore: ^4.8.3 in my flutter project , but when i try to run the project with command flutter run it display to me this error :

> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore] /Users/medyassinemessaoud/Documents/EspritSim/flutter/examples/delivery-1/build/cloud_firestore/intermediates/merged_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16

such that my build.gradle is like that :

def flutterMinSdkVersion = localProperties.getProperty('flutter.minSdkVersion')
if (flutterMinSdkVersion == null) {
  flutterMinSdkVersion = 23
}

 defaultConfig {
        applicationId "com.example.deliveryapp"
        minSdkVersion flutterMinSdkVersion
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

also the local.properties is like that :

flutter.compileSdkVersion=23
but same error , how can i fix it

2

Answers


  1. You need to change the minSDK from

    minSdkVersion flutterMinSdkVersion

     defaultConfig {
            applicationId "com.example.deliveryapp"
            minSdkVersion 21 //this
    
    Login or Signup to reply.
  2. The minSdkVersion declared in the AndroidManifest.xml file of the cloud_firestore library is set to 19, while your Flutter project’s minSdkVersion is set to 16. This conflict occurs because your project’s minimum SDK version is lower than what the library requires.

    Update your project’s minSdkVersion to meet the requirements of the cloud_firestore library. In your build.gradle file, change the minSdkVersion to 19 or higher:

    defaultConfig {
        // ...
        minSdkVersion 19 //at least 19 or higher
        // ...
    }
    

    If you must maintain a minSdkVersion of 16 for your project, you can try using an older version of the cloud_firestore library that supports SDK 16. You can modify your pubspec.yaml file to specify a lower version:

    dependencies:
      cloud_firestore: ^2.5.4
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search