Home > Back-end >  Flutter minSdkVersion and targetSdkVersion error
Flutter minSdkVersion and targetSdkVersion error

Time:12-21

In the old version, we could change it via android/app/build.gradle. Now it gives an error when we change it.

defaultConfig {
        applicationId "com.example.manuel"
        minSdkVersion flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

There are those who fix this problem via local.properties, but this method does not work either.

sdk.dir=C:/Users/user/AppData/Local/Android/Sdk
flutter.sdk=C:\\src\\flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

CodePudding user response:

you need to edit the build.gradle file in the new version as well. As follows;

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
   applicationId "com.example.manuel"
    minSdkVersion 16 // <--- There minSdkVersion Content
    targetSdkVersion 27 <--- There targetSdkVersion (is actually Max Sdk Version) Content
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

then rebuild the project and build it again.

I hope that will be useful.

  • Related