Admob 加载失败,出现错误"at nativeToJSError" - React Native



essue

我的应用程序版本中当前正在运行应用程序,但是由于某些原因,我在测试Android上的React Native时,我现在会收到以下错误。我在计算机上的Android模拟器和连接到我的计算机的Android设备上尝试了这两种方法。

它对iOS非常有效,并且在今天之前为Android工作。

我几周前启用了我的广告,所以这不是缺乏库存的问题,如果是这种情况,这将在我的调试器中显示为缺乏库存

如果有人有建议,那就太好了!这阻止了我为用户推动重要更新。

错误

result     at nativeToJSError (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:105783:17)
    at AdMobComponent._this.onBannerEvent (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:106684:64)
    at Object.invokeGuardedCallbackImpl (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:7899:16)
    at invokeGuardedCallback (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:7990:37)
    at invokeGuardedCallbackAndCatchFirstError (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:7994:31)
    at executeDispatch (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:8188:9)
    at executeDispatchesInOrder (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:8208:11)
    at executeDispatchesAndRelease (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:8303:11)
    at executeDispatchesAndReleaseTopLevel (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:8312:16)
    at forEachAccumulated (blob:http://localhost:8081/6fcdf141-5854-4a90-ba10-5e5c347584ab:8295:14)

通过错误传递的参数

Arguments [callee: ƒ, Symbol(Symbol.iterator): ƒ]
 callee: ƒ render()
  arguments: null
  caller: null
  length: 0
  name: "render"
  prototype: {constructor: ƒ}
  __proto__: ƒ ()
  [[FunctionLocation]]: Admob.js:33
  [[Scopes]]: Scopes[3]
  length: 0
 Symbol(Symbol.iterator): ƒ values()
  arguments: [Exception: TypeError: 'caller', 'callee', and  'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.invokeGetter (<anonymous>:2:14)]
  caller: [Exception: TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at Function.invokeGetter (<anonymous>:2:14)]
  length: 0
  name: "values"
  __proto__: ƒ ()
  [[Scopes]]: Scopes[0]
  __proto__: Object

ADMOB组件代码该代码与React-Native应用程序完全一样,我所做的唯一更改就是删除该应用程序&amp;单位ID。我已经检查了以确保它们正确。

  import React, {Component} from 'react';
    import {
    StyleSheet,
    View,
    Text,
    Dimensions,
  Image,
  TouchableWithoutFeedback
} from 'react-native';
import firebase from 'react-native-firebase';

const Analytics = firebase.analytics()
const Admob = firebase.admob()
const Banner = firebase.admob.Banner;
const AdRequest = firebase.admob.AdRequest;
const request = new AdRequest().addTestDevice()

export default class AdmobComponent extends React.Component{
  constructor(props){
    super(props);
    Admob.initialize('Removed for privacy')
    this.state = {};
  }
  onBannerPress() {
    console.log('add button butotn pushed')
    Analytics.logEvent('banner_click')
  }
  render(){
    return(
      <View>
        <TouchableWithoutFeedback
          style={styles.adMobTouch}
          onPress={() => this.onBannerPress()}
        >
          <Banner
            size={"SMART_BANNER"}
            unitId={'Removed for private'}
            request={request.build()}
            onAdLoaded={() => {
              console.log('Advert loaded');
            }}
            onAdFailedToLoad={(result) => {
              console.log('result', result)
              console.log('Ad failed to load', arguments)
            }}
          />
        </TouchableWithoutFeedback>
      </View>
    )
  }
}

出于开发目的,unitId需要成为预定义值之一https://developers.google.com/admob/android/android/troid/test-ads-ads?hl = en-gb

  1. 横幅:
    • ca-app-pub-3940256099942544/6300978111
  2. 间隙:
    • ca-app-pub-3940256099942544/1033173712
  3. 间隙视频:
    • ca-app-pub-3940256099942544/8691691433
  4. 奖励视频:
    • ca-app-pub-3940256099942544/5224354917
  5. 本机高级:
    • ca-app-pub-3940256099942544/2247696110
  6. 本机高级视频:
    • ca-app-pub-3940256099942544/1044960115

我也有同样的错误,实际上不是错误,您只需要制作生产版本APK,当您的用户有这么多命中率时开始显示真实广告,与此同时,您仍然会在开发模式下看到此错误,但在APK的生产模式下可以正常工作,只需制作发布APK,并且当广告要求太多请求时,广告将在24小时内开始来自您的应用!..

更多信息===> https://github.com/invertase/reaect-native-firebase/issues/2054

相关内容

  • 没有找到相关文章

最新更新