When starting the Metro bundler, you saw this error:
No 'androidAppId' was provided. The native Google Mobile Ads SDK will crash on Android without it.
The AdMob plugin configuration in app.config.js was using the wrong key name:
- ❌ Wrong:
android_app_id(snake_case) - ✅ Correct:
androidAppId(camelCase)
Before (Incorrect):
plugins: [
[
"react-native-google-mobile-ads",
{
android_app_id: "ca-app-pub-3940256099942544~3347511713", // ❌ Wrong key
}
]
]After (Correct):
plugins: [
[
"react-native-google-mobile-ads",
{
androidAppId: "ca-app-pub-3940256099942544~3347511713", // ✅ Correct key
}
]
]The configuration is now correct and the error should no longer appear when you:
- Restart Metro bundler
- Build the app
- Run the app
# Press Ctrl+C to stop current Metro
# Then restart:
npm start# For testing (recommended)
eas build --profile development --platform android
# OR for preview
eas build --profile preview --platform androidWhen you build/run the app, you should see:
- ✅ No "androidAppId was not provided" error
- ✅ Metro bundler starts without warnings
- ✅ AdMob initializes successfully on device
⚠️ Warning on Metro start⚠️ App would crash when trying to load ads⚠️ AdMob SDK wouldn't initialize properly
- ✅ No warnings on Metro start
- ✅ AdMob SDK initializes correctly
- ✅ Ads will load and display properly
- ✅ Ready for testing
The following documentation files have been updated with the correct key name:
- ✅
ADMOB_IMPLEMENTATION.md- Production deployment section - ✅
app.config.js- Live configuration file
After this fix, test the following:
# Stop any running Metro
# Build app
eas build --profile development --platform androidExpected result:
- ✅ Build completes without AdMob warnings
- ✅ No "androidAppId" errors in build logs
Install the built APK and verify:
- ✅ App launches without crash
- ✅ Banner ads load on all screens (Home, Market, Stats, About)
- ✅ Interstitial ads show when switching tabs
- ✅ Console shows "AdMob initialized" message
✅ "AdMob initialized: [adapter statuses]"
✅ "Banner ad loaded successfully"
✅ "Interstitial ad loaded successfully"-
Clear Metro cache:
npx expo start --clear
-
Reinstall dependencies:
rm -rf node_modules npm install
-
Rebuild the app:
eas build --profile development --platform android --clear-cache
Add iosAppId to the same configuration:
plugins: [
[
"react-native-google-mobile-ads",
{
androidAppId: "ca-app-pub-3940256099942544~3347511713", // Android Test ID
iosAppId: "ca-app-pub-3940256099942544~1458002511", // iOS Test ID
}
]
]Note: For now, we're only implementing Android ads, so iosAppId is not required.
✅ Issue: Wrong configuration key name prevented AdMob from initializing
✅ Fix: Changed android_app_id to androidAppId
✅ Status: Configuration corrected and ready for testing
✅ Next: Rebuild app and test ads on device
Fix Applied: 2025-10-18 Status: ✅ RESOLVED Ready for: Building and testing