Android 6+设备上React Native应用在Google Play下载前被索要权限的原因
Hey there, let's figure out why your React Native app is prompting for permissions before users even download it on Android 6+ devices—this is definitely not the standard behavior for modern apps, so let's walk through the most likely causes and fixes.
Common Culprits
1. Your targetSdkVersion is too low
Android 6.0 (API level 23) introduced runtime permissions, which let apps request permissions as needed instead of forcing all of them at install time. If your app's targetSdkVersion is set to below 23, Android will treat it like an "old" app, even on newer devices. That means it'll ask for all declared permissions during installation, just like pre-Marshmallow systems.
Check your android/app/build.gradle file—look for the line:
targetSdkVersion <your-version>
You'll want to set this to at least 23 (ideally 33 or higher, matching the latest recommended Android API levels).
2. Outdated or misconfigured third-party dependencies
Many React Native libraries (like camera, location, or storage packages) declare permissions in their own AndroidManifest.xml files. If a dependency uses a low targetSdkVersion, the merged manifest for your app will inherit that behavior—forcing all permissions to be requested at install time.
To debug this:
- Run
./gradlew app:mergeDebugAndroidManifestin your project's root to generate the merged manifest file. - Open the output file (usually at
app/build/intermediates/merged_manifest/debug/AndroidManifest.xml) and look for<uses-permission>tags. Remove any permissions your app doesn't actually need. - Update all your dependencies to their latest stable versions—most modern libraries now support runtime permissions properly.
3. Incorrect permission declarations in Google Play Console
Sometimes the issue isn't with your app code, but how you've configured permissions in the Play Console. If you've mistakenly marked certain dangerous permissions as "required at install time" instead of "requested at runtime," Google Play might show those permissions upfront.
Head to your Play Console dashboard:
- Go to App content > Permissions and privacy
- Verify that all dangerous permissions (like
ACCESS_FINE_LOCATION,CAMERA) are listed as being requested at runtime, not during installation.
4. Outdated React Native version
Older React Native versions (pre-0.60, for example) had less robust support for Android's runtime permission model. Default configurations might have been set to use older API levels, leading to this install-time permission behavior. If your RN version is several releases behind, upgrading to a recent stable version could resolve the issue.
Fix Steps to Take
- First, bump your
targetSdkVersionto at least 23 (preferably the latest API level supported by React Native). - Audit your merged manifest to remove unnecessary permissions and ensure remaining ones are only requested when needed via RN's
PermissionsAndroidAPI. - Update all third-party packages to their latest versions, replacing any unmaintained libraries that don't support runtime permissions.
- Double-check your Google Play Console permission declarations to match your app's actual runtime permission flow.
This should get your app behaving like modern Android apps—asking for permissions only when the user needs the feature that requires them.
内容的提问来源于stack exchange,提问作者Sephy

