简体   繁体   中英

Flutter minSdkVersion and targetSdkVersion error

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM