본문 바로가기

Dead Code/Flutter_Dart

[플러터] minSdkVersion 위치

특정 패키지를 사용하다보면, 최소한의 안드로이드 SDK를 00버전 이상으로 하라고 에러가 뜰 때가 있는데, app > build.gradle 파일을 보면, minSdkVersion 표기가 되어있지만, 음... 어딘가(flutter.minSdkVersion)를 참조하고 있다.

그냥 지우고 숫자를 입력해도 무방은 하다.

 

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.fluttertest"
    // You can update the following values to match your application needs.
    minSdkVersion flutter.minSdkVersion
    targetSdkVersion flutter.targetSdkVersion
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}

 

 

flutter.minSdkVersion가 어디인고 하니..

~Flutter 설치 폴더~\packages\flutter_tools\gradle\flutter.gradle

안에 아래와 같이 default로 적혀있다. 

 

class FlutterExtension {
    /** Sets the compileSdkVersion used by default in Flutter app projects. */
    static int compileSdkVersion = 33

    /** Sets the minSdkVersion used by default in Flutter app projects. */
    static int minSdkVersion = 16

    /** Sets the targetSdkVersion used by default in Flutter app projects. */
    static int targetSdkVersion = 33

    /**
     * Sets the ndkVersion used by default in Flutter app projects.
     * Chosen as default version of the AGP version below as found in
     */
    static String ndkVersion = "23.1.7779620"

    /**
     * Specifies the relative directory to the Flutter project directory.
     * In an app project, this is ../.. since the app's build.gradle is under android/app.
     */
    String source

    /** Allows to override the target file. Otherwise, the target is lib/main.dart. */
    String target
}

 

 

즉, flutter 버전 업과 동시에 바뀌게 되는 것으로 예상되니, 특별한 경우만 build.gradle 파일을 강제로 수정하고, 그냥 냅두는게 낫겠다.

 

끝.