Skip to content

Fix production crash: SecurityException in canRequestPackageInstalls()#1521

Open
wyqlxf wants to merge 3 commits intoBaseflow:mainfrom
wyqlxf:fix-1502
Open

Fix production crash: SecurityException in canRequestPackageInstalls()#1521
wyqlxf wants to merge 3 commits intoBaseflow:mainfrom
wyqlxf:fix-1502

Conversation

@wyqlxf
Copy link

@wyqlxf wyqlxf commented Mar 18, 2026

This PR attempts to fix #1502

Apps that do not declare REQUEST_INSTALL_PACKAGES in their AndroidManifest.xml will crash with SecurityException when canRequestPackageInstalls() is called. This commonly affects apps that cannot add this permission due to Google Play Store policy restrictions.

Wrap canRequestPackageInstalls() calls in try-catch for SecurityException in both

Pre-launch Checklist

  • I made sure the project builds.
  • 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, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

@wyqlxf wyqlxf changed the title Fix SecurityException when calling canRequestPackageInstalls() withou… Fix production crash: SecurityException in canRequestPackageInstalls() Mar 18, 2026
@wyqlxf wyqlxf force-pushed the fix-1502 branch 2 times, most recently from 1491790 to 6a3c55c Compare March 19, 2026 06:32
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.

[Bug]: Production Crash - SecurityException caused by unconditional canRequestPackageInstalls()call

1 participant