I recently migrated to Expo 50, and since then any APK I build is crashing on load, with the error:
Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
Invalid application ID
It currently works fine for iOS.
I’ve tried so many different way to configure the id (again this was working for years before this migration.
I’m using "expo": "~50.0.20"
and "react-native-google-mobile-ads": "^14.2.5"
What I’ve tried, in various different combinations, and by themselves:
AndroidManifest.xml
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-7389480061982385~6737417759"
tools:replace="android:value"
/>
app.config.js
module.exports = {
expo: {
name: APP-NAME,
slug: MY-SLUG,
scheme: MY-SCHEMA,
version: "2.0.3",
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "light",
splash: {
image: "./assets/splash.png",
resizeMode: "contain",
backgroundColor: "#ffffff",
},
platforms: ["ios", "android", "web"],
updates: {
fallbackToCacheTimeout: 0,
},
assetBundlePatterns: ["**/*"],
ios: {
supportsTablet: true,
bundleIdentifier: MY-BUNDLE-IDENTIFIER,
buildNumber: "1.0.0",
},
android: {
package: MY-PACKAGE,
googleServicesFile:
process.env.GOOGLE_SERVICES_JSON ?? "/android/app/google-services.json",
versionCode: 58,
permissions: [],
playStoreUrl:
"https://play.google.com/store/apps/details?id=MY-APP",
adaptiveIcon: {
foregroundImage: "./assets/icon.png",
backgroundColor: "#FFFFFF",
},
config: {
googleMobileAdsAppId: "ca-app-pub-MY~KEY",
},
},
web: {
favicon: "./assets/favicon.png",
},
extra: {
"react-native-google-mobile-ads": {
android_app_id: "ca-app-pub-MY~KEY",
ios_app_id: "ca-app-pub-MY~KEY",
},
eas: {
projectId: MY-PROJECT-ID,
},
},
plugins: [
[
"react-native-google-mobile-ads",
{
android_app_id: "ca-app-pub-MY~KEY",
ios_app_id: "ca-app-pub-MY~KEY",
},
],
],
},
"react-native-google-mobile-ads": {
android_app_id: "ca-app-pub-MY~KEY",
ios_app_id: "ca-app-pub-MY~KEY",
},
};