Flutter构建App Bundle遇权限与64位兼容问题求助
Hey there, let's work through these two Google Play Console issues you're facing—they're both pretty common when working with older Flutter versions, so here's how to fix them:
问题1:未声明CAMERA权限却被要求设置隐私政策
Even though you didn't add android.permission.CAMERA to your AndroidManifest.xml, it's likely being pulled in automatically by one of your Flutter dependencies. Many packages (like image pickers, barcode scanners, or even some map libraries) declare this permission in their own manifest files, which get merged into your app's final manifest during build.
解决步骤:
- First, identify which dependency is adding the permission: Run
flutter pub depsin your project root to list all installed packages. Look for any that might interact with the camera (even indirectly). - Explicitly remove the permission from your manifest: Add this line to your
AndroidManifest.xml, and make sure to include thetoolsnamespace in the root<manifest>tag:
The<!-- Add this to the root manifest tag if missing --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <!-- Then add this inside the manifest tag --> <uses-permission android:name="android.permission.CAMERA" tools:node="remove" />tools:node="remove"flag tells the build system to strip this permission entirely, even if dependencies try to add it. - Verify the fix: After rebuilding, run
aapt dump permissions build/app/outputs/apk/release/app-release.apk(or the path to your app bundle's extracted APK) to confirm the CAMERA permission is no longer listed.
问题2:App Bundle不符合64位要求
Your Flutter version (1.5.4-hotfix.2) is quite outdated—stable versions after 1.12 started supporting arm64-v8a by default, but older versions need manual configuration. Also, your flutter doctor shows the Android NDK isn't configured, which is required for building 64-bit native code.
解决步骤:
- Configure the Android NDK:
- Open Android Studio, go to
Tools > SDK Manager > SDK Tools, checkNDK (Side by side)and install it. - Add the NDK path to your project's
local.propertiesfile:ndk.dir=C:\\Users\\KLIK-EAT\\AppData\\Local\\Android\\sdk\\ndk\\[your-ndk-version]
- Open Android Studio, go to
- Enable 64-bit ABIs in build.gradle:
Openandroid/app/build.gradleand update theandroidblock to include:android { // ... existing code ... defaultConfig { // ... existing code ... ndk { abiFilters 'armeabi-v7a', 'arm64-v8a' } } splits { abi { enable true reset() include 'armeabi-v7a', 'arm64-v8a' universalApk false // Disable universal APK to force separate ABIs } } } - Clean and rebuild:
Run these commands to ensure a fresh build:flutter clean flutter build appbundle - Verify the App Bundle contains 64-bit code:
Use Google'sbundletoolto check:
You should see abundletool build-apks --bundle=build/app/outputs/bundle/release/app-release.aab --output=app.apks unzip app.apkssplit_arm64-v8a.apkfile in the extracted contents—this confirms 64-bit support is present.
If possible, I'd also recommend upgrading your Flutter version to a newer stable release (like 3.x) to avoid these kinds of legacy issues and get access to newer features and fixes.
内容的提问来源于stack exchange,提问作者RIFAL

