Closed raul-potor closed 1 week ago
Have you ever tried building with that config code inside "extra"?
Because I'm getting an error saying that the app_id is missing. (on expo SDK 50)
On expo 51:
Where: Build file '/home/expo/workingdir/build/node_modules/react-native-google-mobile-ads/android/build.gradle' line: 82
Cannot get property 'googleMobileAdsJson' on extra properties extension as it does not exist
(edited)
Nope, what I ended up doing was removing the root expo
object from app.json
So before it looked like this:
{
"expo": {
"name: "foo",
...
},
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
"ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
}
}
and now it looks like this
{
"name: "foo",
...
"react-native-google-mobile-ads": {
"android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
"ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
}
}
And now the warning is gone and the ads seem to work well (only tested locally with the test units). Don't know if this is the right way to do it or not on SDK 51
Would be great if you can submit a PR to update the docs!
Hmm, I actually don't think this is a reliable solution, the expo-doctor
check fails while validating the app.json
schema with the following error:
• should NOT have additional property 'react-native-google-mobile-ads'.
So I actually think the better approach is to keep the react-native-google-mobile-ads
config inside extra
as @Lamonarch87 suggested. I mean, this approach works, the ads are displayed properly, but because o that error I don't think it's a long-term solution for now, just a workaround.
I see there is already a PR in progress for that: https://github.com/invertase/react-native-google-mobile-ads/pull/584
Hmm, I actually don't think this is a reliable solution, the
expo-doctor
check fails while validating theapp.json
schema with the following error:• should NOT have additional property 'react-native-google-mobile-ads'.
So I actually think the better approach is to keep the
react-native-google-mobile-ads
config insideextra
as @Lamonarch87 suggested. I mean, this approach works, the ads are displayed properly, but because o that error I don't think it's a long-term solution for now, just a workaround.I see there is already a PR in progress for that: #584
I did not suggested to put inside "extra". It is written in Expo Documentation at the bottom of the link provided by you, but for me it's not working.
Even if expo-doctor is saying that is wrong, putting it outside of "expo" is the only way to build successfully for me atm.
I have an iOS and Android app, with root > expo > react-native-google-mobile-ads
, I'm able to build successfully for iOS with EAS and locally. The same app.json
fails for Android:
ERROR: react-native-google-mobile-ads requires an 'android_app_id' property inside a 'react-native-google-mobile-ads' key in your app.json.
No android_app_id property was found in this location. The native Google Mobile Ads SDK will crash on startup without it.
I've tried to include react-native-google-mobile-ads
in extra
or keep both inside and outside but isn't working for Android.
Last chance is patch-package
as suggested but I didn't had time to test it.
I see that this issue is closed, but I'm not clear on what the solution is. Can you please provide a quick example of an app.json file that works for Expo SDK 51?
Documentation Feedback
Hello,
Today I was upgrading my project from Expo SDK 50 to Expo SDK 51, and I had a warning in the console:
This warning was not present on SDK 50, and the key was placed outside the
expo
object as stated in the docsAfter some research, I found this post about the migration from the root
expo
object.I believe the documentation should be updated in this case, as it still states that the
react-native-google-mobile-ads
should be placed outside theexpo
block: