You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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 deps in 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 the tools namespace in the root <manifest> tag:
    <!-- 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" />
    
    The 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.

解决步骤:

  1. Configure the Android NDK:
    • Open Android Studio, go to Tools > SDK Manager > SDK Tools, check NDK (Side by side) and install it.
    • Add the NDK path to your project's local.properties file:
      ndk.dir=C:\\Users\\KLIK-EAT\\AppData\\Local\\Android\\sdk\\ndk\\[your-ndk-version]
      
  2. Enable 64-bit ABIs in build.gradle:
    Open android/app/build.gradle and update the android block 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
            }
        }
    }
    
  3. Clean and rebuild:
    Run these commands to ensure a fresh build:
    flutter clean
    flutter build appbundle
    
  4. Verify the App Bundle contains 64-bit code:
    Use Google's bundletool to check:
    bundletool build-apks --bundle=build/app/outputs/bundle/release/app-release.aab --output=app.apks
    unzip app.apks
    
    You should see a split_arm64-v8a.apk file 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:46:38