Baseflow / Baseflow/flutter-permission-handler
[Regression]: permission_handler_android 14.0.0 requires compileSdk 37, which no SDK platform or AGP release provides
- Dominant language
- Dart
- Stars
- 2.2k
- Forks
- 970
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 2
Description
### Is there an existing issue for this?
- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
### Affected platform(s)
- [x] 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`:
```console
$ 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:
```yaml
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 |
Contributor guide
Research direction
Reproduce the failure with `flutter create repro`, `flutter pub add permission_handler`, and `flutter build apk --debug`; compare the Android configuration in `android/app/build.gradle.kts` with the plugin’s compile SDK requirement. Review the root `build.gradle.kts` workaround and AAR metadata behavior, then confirm the package builds with an SDK and AGP combination supported by the published Android platform.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, dart
- Domain
- build-system, mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100