Package/plugin issues when upgrading to flutter 3.47.0 (AGP (Gradle) 9.1.0, KGP (Kotlin) 2.4.0)


I want to upgrade my flutter and my AGP version so when I deploy it to play store, the warning about optimization will disappear. However, I run into a new problem when I tried to upgrade from flutter 3.38.5 to 3.47.0. The problem is not all of my plugins are using or compatible with the KGP 2.4.0 and currently I can't even build my own app :( any suggestion on how to fix this issues? Here are some of the package that are NOT compatible with the latest flutter version and AGP 9.1.0. I have done all of the steps that are required to migrate from older flutter version to the 3.47.0 (newest at the time) and from what I read, the plugins mentioned below still manually apply the KGP, and which are not compatible with the AGP 9.1.0. Any suggestion on what should I do?

WARNING: Your app uses the following plugins that apply Kotlin Gradle Plugin (KGP): firebase_remote_config, flutter_timezone, google_sign_in_android, shared_preferences_android, url_launcher_android, webview_flutter_android

Future versions of Flutter will fail to build if your app uses plugins that apply KGP.

- permission_handler_android compiles against Android SDK 37

Here are all of my packages version and the command that I use to run the project. I am using flavoring + FVM and here are the complete error message when applying KGP

Command:

fvm flutter run --flavor staging -t lib/main_staging.dart

Error:

* What went wrong:
An exception occurred applying plugin request [id: 'kotlin-android']
> Failed to apply plugin 'kotlin-android'.
   > Failed to apply plugin 'org.jetbrains.kotlin.android'
     The 'org.jetbrains.kotlin.android' plugin is no longer required for Kotlin support since AGP 9.0.
     Solution: Remove the 'org.jetbrains.kotlin.android' plugin from this project's build file: ..\..\..\..\..\AppData\Local\Pub\Cache\hosted\pub.dev\google_sign_in_android-7.2.11\android\build.gradle.kts.
     See https://kotl.in/gradle/agp-built-in-kotlin for more details.
      > java.lang.Throwable (no error message)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights from a Build Scan (powered by Develocity).
> Get more help at https://help.gradle.org.

BUILD FAILED in 15s
Running Gradle task 'assembleStagingDebug'...                      16.1s

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Starting AGP 9+, the default has become built-in Kotlin.                                                          │
│ This results in a build failure when applying the kotlin-android plugin.                                              │
│ To resolve this, migrate to built-in Kotlin.                                                                          │
│                                                                                                                       │
│ For instructions on how to migrate, see: https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleStagingDebug failed with exit code 1

settings.gradle

org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
android.builtInKotlin=true
# This newDsl flag was added automatically by Flutter migrator
android.newDsl=false

the one that causes the problem was the builtInKotlin = true. If I set it to false, the app works just fine

List of Packages:

 
 cupertino_icons: ^1.0.8
  sqflite: ^2.4.3
  path: ^1.9.1
  path_provider: ^2.1.5
  uuid: ^4.5.1
  intl: ^0.20.2
  go_router: ^17.5.0
  google_fonts: ^8.2.1
  fl_chart: ^1.0.0
  dartz: ^0.10.1
  get_it: ^9.2.0
  flutter_bloc: ^9.1.1
  equatable: ^2.0.7
  shared_preferences: ^2.5.4
  share_plus: ^13.3.0
  provider: ^6.1.5+1
  flutter_local_notifications: ^22.3.0
  flutter_timezone: ^5.0.1
  permission_handler: ^13.0.1
  firebase_core: ^4.13.0
  firebase_auth: ^6.5.7
  google_sign_in: ^7.2.0
  cached_network_image: ^3.4.1
  lottie: ^3.5.1
  dotlottie_loader: ^0.0.5
  file_picker: ^12.0.0
  package_info_plus: ^10.2.1
  firebase_remote_config: ^6.5.6
  url_launcher: ^6.3.2
0
Aug 26 at 11:56 AM
User Avatarchristian leon
#android#flutter#kotlin#gradle#android-gradle-plugin

No answer found for this question yet.