Skip to content

fix(android): lower compileSdk to 36 and use literal constants for API 37 - #1588

Draft
vishnuprasad0 wants to merge 1 commit into
Baseflow:mainfrom
vishnuprasad0:fix/compile-sdk-36-local-network-literals
Draft

vishnuprasad0 wants to merge 1 commit into
Baseflow:mainfrom
vishnuprasad0:fix/compile-sdk-36-local-network-literals

Conversation

@vishnuprasad0

@vishnuprasad0 vishnuprasad0 commented Nov 18, 2026 •

Copy link
Copy Markdown

Fixes #1556.
permission_handler_android sets compileSdk = 37, and that doesn't build. Android 17 installs its
platform as android-37.0, but AGP asks for the hash string android-37 and doesn't find it. This
drops compileSdk back to 36 and uses literals for the two API-37-only symbols. Runtime behaviour
is unchanged.
I ran the same build on both branches, same machine, same command. On main the toolchain installs
the platform itself and the build still fails, so it isn't a missing SDK on my side:

Installing Android SDK Platform 37.0 in .../Android/Sdk/platforms/android-37.0
"Install Android SDK Platform 37.0 (revision 2)" complete.
> Failed to find target with hash string 'android-37' in: .../Android/sdk

On this branch it builds: √ Built build/app/outputs/flutter-apk/app-debug.apk.
Both runs needed --android-skip-build-dependency-validation, because this example's Gradle wrapper
is 9.1.0 and Flutter now wants 9.3.1. That's unrelated to this change and I used the flag on both
sides so the comparison is fair.
The permission string is the part worth double-checking, since hasPermissionInManifest compares
strings and a typo would silently disable the permission on Android 17. I took
"android.permission.ACCESS_LOCAL_NETWORK" from the Android reference, where it's listed as the
constant value and added in API 37. CINNAMON_BUN becomes a private = 37 constant with a comment
saying why.
Two things you should know before reviewing. First, literals aren't the only fix — bumping AGP to a
version that resolves android-37.0 would let compileSdk = 37 stay, and avoid carrying literals
that go stale once API 37 tooling is normal. I picked the smaller change because it unblocks people
today, but if you'd rather fix it at the AGP level I'll redo it, or close this for your own fix.
Second, nothing in jvm-tests covers the ACCESS_LOCAL_NETWORK mapping, so no test guards that
literal. The existing JVM tests don't touch hasPermissionInManifest at all, and wiring that up
looked bigger than this fix deserves — happy to add it if you want it in scope.

  • I made sure the project builds. (flutter build apk --debug on permission_handler_android/example, output above)
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy. (permission_handler_android 14.1.1 -> 14.1.2; the app-facing package's ^14.1.0 already resolves to it)
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///). (no public Dart API changed; the Java constants carry comments, and ANDROID_PERMANENTLY_DENIED_FIX_GUIDE.md no longer tells readers to use compileSdk 37)
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests. (no test guards the literal — see above)
  • I made sure all existing and new tests are passing. (Dart 20/20 and 48/48; JVM tests 3 passed, 0 failed)
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors. (remaining infos are the repo-wide Flutter 3.50 material.dart deprecation in the example apps, which also fails CI on unrelated PRs like fix(apple): deliver requestPermissions result on the main queue #1587)

…I 37

Lower compileSdk from 37 to 36 in permission_handler_android and example apps,
replacing Manifest.permission.ACCESS_LOCAL_NETWORK and Build.VERSION_CODES.CINNAMON_BUN
with their literal values ('android.permission.ACCESS_LOCAL_NETWORK' and 37).
This resolves the inability of consumers to compile due to missing 'android-37'
SDK platform and lack of minor-versioned platform resolution in released AGP,
while preserving identical runtime behavior on Android 17 devices.

Fixes Baseflow#1556

Co-Authored-By: Claude <noreply@anthropic.com>
@vishnuprasad0
vishnuprasad0 marked this pull request as draft November 18, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant