Nidew
Nidew

Reputation: 487

uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore]

uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore]
 D:\doctor_chat\build\cloud_firestore\intermediates\library_manifest\debug\AndroidManifest.xml as the library might be using APIs not available in 16

Suggestion: use a compatible library with a minSdk of at most 16,
    or increase this project's minSdk version to at least 19,
    or use tools:overrideLibrary="io.flutter.plugins.firebase.firestore" to force usage (may lead to runtime failures)

Im getting above error in my code. how to solve this.

enter image description here

enter image description here

Upvotes: 15

Views: 24195

Answers (8)

zyx_cba
zyx_cba

Reputation: 53

for Flutter 3.22.0, in local.properties, add this

flutter.minSdkVersion = 23
flutter.targetSdkVersion = 28//modify as per your project

in app\build.gradle

def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))

def minSdkVersion  = localProperties.getProperty("flutter.minSdkVersion ")
    if (minSdkVersion  == null) {
        minSdkVersion  = "23"
}
def targetSdkVersion =
localProperties.getProperty("flutter.targetSdkVersion")
    if (targetSdkVersion == null) {
        targetSdkVersion = "28"
    }
android {
  
    defaultConfig {
        minSdk = minSdkVersion.toInteger()
        targetSdk = targetSdkVersion.toInteger()
       }
}

Upvotes: 4

ElapsedSoul
ElapsedSoul

Reputation: 825

If using flutter, the build.gradle show us minSdkVersion flutter.minSdkVersion.

So we need to update it at flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy

Upvotes: 2

Ashfaque
Ashfaque

Reputation: 332

File Location :- ....\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy

Change this line "static int minSdkVersion = 16" To " static int minSdkVersion = 21"

Upvotes: 0

Sajal Sahu
Sajal Sahu

Reputation: 89

You should make the following changes in "build.gradle" file under "yourapp/android/app/"

minSdkVersion: 19
targetSdkversion: 28

It should work as usual now

Upvotes: 0

Andrey Ferriyan
Andrey Ferriyan

Reputation: 1

Starting from flutter 2.8 you should change minSdkVersion from android/local.properties

Upvotes: -2

Yashraj
Yashraj

Reputation: 999

Update minSdkVersion 16 to 19 in android/app/build.gradle

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    minSdkVersion 16 // change it to 19 
}

Upvotes: 1

Ahmad Raza
Ahmad Raza

Reputation: 858

In your app Navigate to android/app/build.gradle and change minsdk from 16 to 21

Here is an image

Hope it will resolve your problem

Upvotes: 20

tareq albeesh
tareq albeesh

Reputation: 1861

go in your project to android/app/build.gradle file and edit the minSdkVersion to:

minSdkVersion 19

Upvotes: 3

Related Questions