skip to Main Content

android/app/build.gradle


    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "cmon.com"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

Error:

G:FluttercmonandroidappsrcdebugAndroidManifest.xml Error:
    uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:cloud_firestore] G:Fluttercmonbuildcloud_firestoreintermediatesmerged_manifestdebugAndroidManifest.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)

FAILURE: Build failed with an exception.

How to modify the above given default versions. What is the reason for this error?

3

Answers


  1. You can manually add the minimum sdk version like this

    defaultConfig {
            applicationId "cmon.com"
            minSdkVersion 21
            targetSdkVersion flutter.targetSdkVersion
            versionCode flutterVersionCode.toInteger()
            versionName flutterVersionName
        }
    
    Login or Signup to reply.
  2. In an Android Studio project, you have to edit the build.gradle file. In a flutter project, it is found at the path ./android/app/build.gradle.

    The parameter that needs to be changed in minSdkVersion is 19

    defaultConfig {
        applicationId "com.example.myapplication"
        //This is the part that needs to be changed, previously was 16
        minSdk 19 
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }
    

    Android SDK 16-18 is only a Best-effort platforms.
    Best-effort means supported through community testing, are platforms we believe we support through coding practices and ad-hoc testing, but rely on the community for testing.

    Here is the reference link.
    https://docs.flutter.dev/development/tools/sdk/release-notes/supported-platforms#supported-google-tested-platforms

    Login or Signup to reply.
  3. In your android/app/build.gradle flie,

    comment this line – minSdkVersion flutter.minSdkVersion
    and just add minSdkVersion 21 or flutter.minSdkVersion=21

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.phone_vrification"
        minSdkVersion 21
       // minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search