Skip to content

audio_session not compatible with AGP9+ #175

@under3415

Description

@under3415

Since upgrading to Gradle 9.3.1 and AGP 9.0 cannot build due to audio_session issue

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\dejan\AppData\Local\Pub\Cache\hosted\pub.dev\audio_session-0.2.2\android\build.gradle' line: 33

* What went wrong:
A problem occurred evaluating project ':audio_session'.
> 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: ..\..\..\..\Users\dejan\AppData\Local\Pub\Cache\hosted\pub.dev\audio_session-0.2.2\android\build.gradle.
     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.
==============================================================================

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

Flutter Doctor:

[√] Flutter (Channel stable, 3.38.9, on Microsoft Windows [Version 10.0.26200.7705], locale en-NZ) [626ms]
    • Flutter version 3.38.9 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 67323de285 (3 days ago), 2026-01-28 13:43:12 -0800
    • Engine revision 587c18f873
    • Dart version 3.10.8
    • DevTools version 2.51.1
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
      omit-legacy-version-file, enable-lldb-debugging

[√] Windows Version (11 Pro 64-bit, 25H2, 2009) [1,374ms]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [3.8s]
    • Android SDK at C:\Users\dejan\AppData\Local\Android\sdk
    • Emulator version 36.3.10.0 (build_id 14472402) (CL:N/A)
    • Platform android-36.1, build-tools 36.1.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
    • All Android licenses accepted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions