简体   繁体   English

Flutter minSdkVersion 和 targetSdkVersion 错误

[英]Flutter minSdkVersion and targetSdkVersion error

In the old version, we could change it via android/app/build.gradle.在旧版本中,我们可以通过 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.有些人通过 local.properties 解决了这个问题,但是这种方法也不起作用。

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.您还需要在新版本中编辑build.gradle文件。 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.我希望这会有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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