Skip to content

[Bug]: device_info_plus not compatible with AGP9+ #3754

@under3415

Description

@under3415

Platform

Android

Plugin

device_info_plus

Version

12.3.0

Flutter SDK

3.38.9

Steps to reproduce

Upgrade project to Gradle 9 and AGP 9 (currently 9.3.1)

Code Sample

Example project

Logs

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\device_info_plus-12.3.0\android\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating project ':device_info_plus'.
> 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\user\AppData\Local\Pub\Cache\hosted\pub.dev\device_info_plus-12.3.0\android\build.gradle.
     See https://kotl.in/gradle/agp-built-in-kotlin for more details.
      > java.lang.Throwable (no error message)
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':device_info_plus'.
> Failed to notify project evaluation listener.
   > java.lang.NullPointerException (no error message)
   > java.lang.NullPointerException (no error message)
   > Android Gradle Plugin: project ':device_info_plus' does not specify `compileSdk` in build.gradle (C:\Users\user\AppData\Local\Pub\Cache\hosted\pub.dev\device_info_plus-12.3.0\android\build.gradle).

==============================================================================

BUILD FAILED in 37s
Running Gradle task 'bundleRelease'...                             38.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 at                  │
│ C:\src\projects\workoutfromhome\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 │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Flutter Doctor

[√] Flutter (Channel stable, 3.38.9, on Microsoft Windows [Version 10.0.26200.7705], locale en-NZ) [543ms]
    • Flutter version 3.38.9 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 67323de285 (8 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,087ms]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [2.6s]
    • Android SDK at C:\Users\user\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.

[√] Chrome - develop for the web [255ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.24) [254ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.14.36908.2
    • Windows 10 SDK version 10.0.26100.0
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:  
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[√] Connected device (3 available) [206ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26200.7705]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 144.0.7559.110
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 144.0.3719.104

[√] Network resources [605ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions