[๐] ๐ฅ AD_ID Permission Added to AndroidManifest Without Ads or Analytics Usage (Expo + RNFirebase)
Issue
I am using react-native-firebase modules (see package.json below) in my Expo 54/React Native project. When building my app for release (AAB for Google Play), the final merged AndroidManifest.xml contains the following permissions:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AD_ID"/>
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_ATTRIBUTION"/>
I do not use ads or Firebase Analytics in my app, but I do use modules like Messaging, Crashlytics, Firestore, and Remote Config. I have tried using Expo config plugins and manifest merger rules to remove the AD_ID permission (as metioned on issue https://github.com/invertase/react-native-firebase/issues/7213), but it still appears in the final manifest after build.
This causes my app to be flagged by Google Play for using the Advertising ID, which I do not intend to collect or use.
Questions:
- Which react-native-firebase modules or their dependencies are responsible for adding the AD_ID permission?
- Is there a recommended way to prevent this permission from being added, especially for apps that do not use ads or analytics?
- Is there a way to configure the library or dependencies to exclude this permission from the final manifest?
Additional notes:
- I have tried using Expo config plugins and manifest merger rules (
tools:node=\"remove\") to remove the permission, but it still appears in the final manifest. - I do not use ads or Firebase Analytics, and have disabled analytics collection where possible.
- This issue is blocking my app release due to Google Play policy.
Project Files
Javascript
Click To Expand
package.json:
{
"dependencies": {
"@mapbox/mapbox-sdk": "^0.16.1",
"@miblanchard/react-native-slider": "^2.6.0",
"@react-native-async-storage/async-storage": "2.2.0",
"@react-native-firebase/app": "^22.3.0",
"@react-native-firebase/crashlytics": "^22.3.0",
"@react-native-firebase/firestore": "^22.3.0",
"@react-native-firebase/messaging": "^22.3.0",
"@react-native-firebase/remote-config": "^22.3.0",
"@react-navigation/core": "^7.3.1",
"@react-navigation/drawer": "^7.1.1",
"@react-navigation/native": "^7.0.14",
"@react-navigation/stack": "^7.1.0",
"@rnmapbox/maps": "^10.1.44",
"dotenv": "^16.4.5",
"expo": "^54.0.7",
"expo-blur": "~15.0.7",
"expo-build-properties": "~1.0.8",
"expo-dev-client": "~6.0.12",
"expo-image-picker": "~17.0.8",
"expo-linking": "~8.0.8",
"expo-location": "~19.0.7",
"expo-status-bar": "~3.0.8",
"formik": "^2.4.6",
"i18next": "^25.3.2",
"lottie-react-native": "~7.3.1",
"moment": "^2.30.1",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-i18next": "^15.6.0",
"react-native": "0.81.4",
"react-native-app-intro-slider": "^4.0.4",
"react-native-currency-input": "^1.1.1",
"react-native-date-picker": "^5.0.7",
"react-native-device-info": "^14.0.0",
"react-native-dotenv": "^3.4.11",
"react-native-element-dropdown": "^2.12.2",
"react-native-gesture-handler": "^2.27.1",
"react-native-linear-gradient": "^2.8.3",
"react-native-mask-input": "^1.2.3",
"react-native-paper": "^5.12.5",
"react-native-reanimated": "~4.1.0",
"react-native-render-html": "^6.3.4",
"react-native-safe-area-context": "^5.5.2",
"react-native-screens": "~4.16.0",
"react-native-svg": "15.12.1",
"react-native-uuid": "^2.0.2",
"react-native-vector-icons": "^10.2.0",
"styled-components": "^6.1.19",
"yup": "^1.4.0",
"expo-updates": "~29.0.10"
}
}
firebase.json for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile:
- [x] I'm not using Pods
- [ ] I'm using Pods and my Podfile looks like:
# N/A
AppDelegate.m:
// N/A
Android
Click To Expand
Have you converted to AndroidX?
- [x] my application is an AndroidX application?
- [ ] I am using
android/gradle.settingsjetifier=truefor Android compatibility? - [ ] I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/A
android/app/build.gradle:
// N/A
android/settings.gradle:
// N/A
MainApplication.java:
// N/A
AndroidManifest.xml:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AD_ID"/>
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_ATTRIBUTION"/>
<!-- ...other permissions... -->
<!-- inside application... -->
<meta-data android:name="firebase_analytics_collection_enabled" android:value="true"/>
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="false"/>
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="true"/>
<meta-data android:name="google_analytics_ssaid_collection_enabled" android:value="true"/>
<meta-data android:name="google_analytics_automatic_screen_reporting_enabled" android:value="true"/>
<meta-data android:name="google_analytics_default_allow_analytics_storage" android:value="true"/>
<meta-data android:name="google_analytics_default_allow_ad_storage" android:value="true"/>
<meta-data android:name="google_analytics_default_allow_ad_user_data" android:value="true"/>
<meta-data android:name="google_analytics_default_allow_ad_personalization_signals" android:value="true"/>
<meta-data android:name="app_data_collection_default_enabled" android:value="true"/>
Environment
Click To Expand
react-native info output:
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.19045
CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
Memory: 3.69 GB / 15.92 GB
Binaries:
Node:
version: 22.12.0
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 11.5.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-232.10227.8.2321.11479570
Visual Studio:
- 17.9.34728.123 (Visual Studio Community 2022)
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 20.0.2
wanted: ^20.0.2
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.4
wanted: 0.81.4
react-native-windows: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
-
Platform that you're experiencing the issue on:
- [ ] iOS
- [x] Android
- [ ] iOS but have not tested behavior on Android
- [ ] Android but have not tested behavior on iOS
- [ ] Both
-
react-native-firebaseversion you're using that has this issue:-
22.3.0
-
-
Firebasemodule(s) you're using that has the issue:-
not sure which: app, crashlytics, firestore, messaging, remote-config
-
-
Are you using
TypeScript?-
NO
-
- ๐ Check out
React Native FirebaseandInvertaseon Twitter for updates on the library.
Hi there, it is quite likely analytics could be doing this but if you dont have it imported in your project then I would find it strange. After some research, this solution appeared to be agreed upon:
<meta-data android:name="google_analytics_adid_collection_enabled"
android:value="false" />
<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />
Let me know if this helps at all please.
@MichaelVerdon
Thanks for looking into this! I checked my package.json files and I donโt see the analytics library installed in the project, which makes this issue a bit unexpected. Do you know from which RNFirebase package this might be coming?
Since I donโt handle the Android files directly when working with the Expo workspace, Iโll adjust the plugin to properly insert the required uses-permission and meta-data entries into the AndroidManifest.xml.
Iโll get back to you once Iโve tested this to confirm whether it resolves the issue.
After implementing the plugin, I encountered an error that confirmed this tag comes from Analytics. I updated the plugin to change the value of this meta-data, but while running gradlew I got the following error:
Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed : Attribute meta-data#google_analytics_adid_collection_enabled@value value=(false) from AndroidManifest.xml:24:72-93
is also present at [:react-native-firebase_analytics] AndroidManifest.xml:20:13-33 value=(true).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:24:5-95 to override.
The meta-data entry has to be added with the tools:replace="android:value" attribute; otherwise, the app wonโt build.
This is where the issue gets even stranger. I managed to generate a final build with the corrected merged AndroidManifest.xml. I verified this by downloading the .aab file and running the following command to extract the manifest:
java -jar bundletool-all.jar dump manifest --bundle=my-app.aab --output=AndroidManifest.xml
After doing so, I confirmed that the plugin correctly removed the adid uses-permission and set the meta-data value to false.
However, when I tried to submit this exact build to the Google Play Store using eas submit, I received the following error:
[!] Google Api Error: Invalid request - This release includes the com.google.android.gms.permission.AD_ID permission but your declaration on Play Console says your app doesn't use advertising ID. You must update your advertising ID declaration.
This is confusing because, based on the merged AndroidManifest.xml, the permission had been completely removed โ yet the submission still failed.
I think the next step is to identify how this behavior is happening inside the library and then provide a patch to prevent it from occurring in future builds.
Hi there, thanks for the further investigation. Doing some further digging, along with what I suggested, I want you to try put this in your manifest:
<manifest
xmlns:tools="http://schemas.android.com/tools"
>
Seeing that were using Expo here we unfortunately cannot go into android studio and search for the manifest of the dependency using this, you could probably try blocking it in app config:
{
"expo": {
"android": {
"blockedPermissions": ["com.google.android.gms.permission.AD_ID"]
}
}
}
If this is occuring from here then I would guess it to be Crashlytics, you could try disable it for now and see if the same error comes back. Let me know how this goes please.
Sorry for the late response,
Just to let you know I'm still working on it.
I can already tell you it appears to be fixed, I'm just trying to investigate what exactly fixed and why it happened.
I have expo app and added firebase analytics (no ads). What worked for me:
firebase.json
{
"react-native": {
"google_analytics_adid_collection_enabled": false
}
}
app.json
"expo": {
"android": {
"blockedPermissions": ["com.google.android.gms.permission.AD_ID"]
}
}
Hello ๐, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.