Skip to content

[Regression]: permission_handler_android 14.0.0 requires compileSdk 37, which no SDK platform or AGP release provides #1556

Description

@vitoramaral10

Is there an existing issue for this?

Affected platform(s)

  • Android

Old behavior

With permission_handler_android 13.x (compileSdkVersion 35), an app compiling against compileSdk 36 built fine.

Current behavior

permission_handler_android 14.0.0 raised compileSdkVersion from 35 straight to 37, and requires every consumer to do the same:

BREAKING CHANGES: When updating to version 14.0.0 make sure to also set the compileSdkVersion in the app/build.gradle file to 37.

That requirement currently cannot be satisfied by anyone, for two independent reasons.

1. There is no android-37 SDK platform to install. Android now publishes minor API versions, and API 37 ships as android-37.0, not android-37:

$ sdkmanager --list | grep 'platforms;android-3[5-9]'
  platforms;android-35    | 2 | Android SDK Platform 35
  platforms;android-36    | 2 | Android SDK Platform 36
  platforms;android-36.1  | 1 | Android SDK Platform 36.1
  platforms;android-37.0  | 2 | Android SDK Platform 37.0

$ sdkmanager "platforms;android-37"
Warning: Failed to find package 'platforms;android-37'

AGP resolves compileSdk = 37 to the hash string android-37, so even with android-37.0 installed the build fails:

Could not determine the dependencies of task ':permission_handler_android:compileDebugJavaWithJavac'.
> Failed to find target with hash string 'android-37' in: /home/user/Android/Sdk

2. No released AGP supports compileSdk 37. AGP 9.0.1, the latest stable, rejects it:

Execution failed for task ':app:checkDebugAarMetadata'.
> An issue was found when checking AAR metadata:

    1.  Dependency ':permission_handler_android' requires libraries and applications that
        depend on it to compile against version 37 or later of the Android APIs.

        :app is currently compiled against android-36.

        Also, the maximum recommended compile SDK version for Android Gradle
        plugin 9.0.1 is 36.

So the plugin asks for an SDK level that (a) is not published under that name and (b) is above what the newest AGP supports. Every app that resolves to 14.0.0 — which is everyone on permission_handler: ^13.0.1, since it allows permission_handler_android: ^14.0.0 — cannot build for Android at all.

Steps to reproduce

  1. flutter create repro && cd repro
  2. flutter pub add permission_handler (resolves permission_handler_android 14.0.0)
  3. flutter build apk --debug
  4. The build fails at :app:checkDebugAarMetadata with the message above.
  5. Setting compileSdk = 37 in android/app/build.gradle.kts does not help — it then fails earlier, at Failed to find target with hash string 'android-37'.

Things I tried that do not work

  • sdkmanager "platforms;android-37" — the package does not exist; only platforms;android-37.0 does.
  • Installing platforms;android-37.0 — AGP still looks for android-37.
  • Pinning only permission_handler_android: ">=13.0.0 <14.0.0" — permission_handler: ^13.0.1 requires ^14.0.0, so the solver refuses.
  • Capping the plugin's compileSdk back to 36 from the root build.gradle.kts via subprojects { ... } — the plugin itself then compiles, but checkDebugAarMetadata still rejects the app, because the AAR metadata records the 37 requirement.

Workaround

Downgrade the umbrella package, which pulls permission_handler_android 13.x:

permission_handler: ^12.0.3

Suggested fix

Declare compileSdk = 36 in permission_handler_android until an AGP release actually supports API 37 — or, if something in the plugin genuinely needs API 37, declare it in the form AGP can resolve once that support lands (compileSdk = 37 plus compileSdkMinor = 0, matching the published android-37.0 package).

As a data point, 13.x to 14.0.0 skipped API 36 entirely (35 to 37), so simply targeting 36 would still be a step forward and would build everywhere today.

Possibly related: #1531 ([Android] AGP 9 / built-in Kotlin compatibility).

Version info

permission_handler 13.0.1 (resolves permission_handler_android 14.0.0, published 2026-07-31)
Flutter 3.44.6 (stable)
Dart 3.12.2
Android Gradle Plugin 9.0.1
Gradle 9.1.0
App compileSdk 36 (flutter.compileSdkVersion)
Host OS Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions