はじめに
Androidで公開しているアプリに対して、以下のような警告が届いた。
古いバージョンの Android を対象にしているアプリが 2 個あることが判明しました。Google Play では、ユーザーに安全で保護されたエクスペリエンスを提供するため、すべてのアプリについて 2023/08/31までに対象 API レベル要件に準拠することを義務付けています。
アプリを更新して Android 13 を対象にしないといけないようです
ターゲットとなるAndroidのOSバージョン(APIレベル)を変更する
android/app/build.gradle
android {
compileSdkVersion 33 // // 33に変更!
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.sample.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion 33 // 33に変更!
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
}
compileSdkVersion
とtargetSdkVersion
を33に変更しましょう。
初期値では以下のようになってるかと思いますが、
defaultConfig {
targetSdkVersion flutter.targetSdkVersion
...
}
flutter.targetSdkVersion
を消して「33」みたいな数値を直接入れても問題ないようです!
あとはバージョンを上げて公開すればOKです