简体   繁体   中英

Android minSdkVersion with Flutter(v2.8.1)

I have installed the firebase package. as we know minSdkVersion 19 is recommended. So, I wanted to do this process. however, I saw that this line is included in the android/app/build.gradle file

minSdkVersion flutter.minSdkVersion

The previous view would be as follows

minSdkVersion 16

Is it possible to change the version with a file? that is, whether the value for minSdkVersion is split into another file?

Thanks!

Add these lines in your android/local.properties

sdk.dir=/Users/{username}/Library/Android/sdk
flutter.sdk=/Users/{username}/Developer/flutter
flutter.buildMode=debug
flutter.versionName=1.0.0
flutter.versionCode=1

flutter.minSdkVersion=21         // new
flutter.targetSdkVersion=30      // new
flutter.compileSdkVersion=30     // new

then in your android/app/build.gradle replace these three lines

    minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
    targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
    versionCode flutterVersionCode.toInteger()

Adding flutter.minSdkVersion=21 to android/local.properties solved the issue for me.

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