How to change Android minSdkVersion in flutter project

前端 未结 4 1539
梦毁少年i
梦毁少年i 2020-12-04 20:50

I was trying to start a flutter project for an App using bluetooth to communicate. For that, I was using flutter blue.

Unfortunately, when trying to run (on an Andro

4条回答
  •  孤城傲影
    2020-12-04 21:27

    It is indeed possible to increase minSdkVersion, but it took me way too much time to find it out because google searches mostly yields as result discussions about the absolute minimum Sdk version flutter should be able to support, not how to increase it in your own project.

    Like 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 is, of course, minSdkVersion 16, bumping it up to what you need (in this case 19).

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.projectname"
        minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    

    Seems obvious now, but took me long enough to figure it out on my own.

提交回复
热议问题