Flutter iOS & Android permissions: what each plugin needs in Info.plist and AndroidManifest
说明与用途
Flutter 应用常常遗漏必要的原生权限配置,导致崩溃。本文汇总了 10 个流行插件的需求,演示如何添加有意义的使用说明,并使用 plumb 验证配置。
问题
Flutter plugins require native permission entries that developers often miss, causing runtime failures or app crashes.
结果
After applying the checklist and using plumb, the app’s native permission configuration matches plugin requirements, eliminating crashes and ensuring proper permission prompts.
工作流
- Add plugin to pubspec.yaml and run flutter pub get.
- Insert required iOS usage strings (e.g., NSCameraUsageDescription) with real sentences.
- Add iOS entitlements (e.g., aps-environment) and background modes if needed.
- Add AndroidManifest permissions,
<queries>,<meta-data>and receivers as specified. - Extend MainActivity to FlutterFragmentActivity for plugins like local_auth.
- Run
dart pub global activate plumb && plumb doctorto audit the app’s native config. - Fix any reported missing or empty entries.
- Rebuild and test the app to ensure permissions work correctly.
证据
Every iOS permission your app actually asks for needs a *UsageDescription* in Info.plist, with a real sentence, not TODO.
I ran a checker over the 25 most-starred open-source Flutter apps and verified every finding by hand.
plumb doctor checks all of this for you, read-only.
- 记录日期: 2026-11-02T20:28:48.055Z