我应该使用哪个版本的Expo来集成react-native-google-mobile-ads?

fnx2tebb  于 2023-06-06  发布在  React
关注(0)|答案(1)|浏览(165)

集成react-native-google-mobile-ads的expo的推荐版本是什么?
我尝试将react-native-google-mobile-ads与Expo v48集成。但不幸的是,我得到了一个错误。

**Error:** "Invariant Violation: requireNativeComponent: 'RNGoogleMobileAdsBannerView' was not found in the UIManager".
# app.json

{
    "expo": {
    ...
    },
    "react-native-google-mobile-ads": {
      "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
    }
  }
ffscu2ro

ffscu2ro1#

请确保您正确地遵循设置,在app.json配置中添加admob id

// <project-root>/app.json
{
  "expo": {
    // ...
  },
  "react-native-google-mobile-ads": {
    "android_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx",
    "ios_app_id": "ca-app-pub-xxxxxxxx~xxxxxxxx"
  }
}

来源:https://docs.page/invertase/react-native-google-mobile-ads

相关问题