gpt4 book ai didi

android - Admob 加载失败,错误为 "at nativeToJSError"- React Native

转载 作者:太空狗 更新时间:2023-10-29 13:45:47 24 4
gpt4 key购买 nike

问题

我的应用程序当前在我的应用程序的产品版本中运行,但由于某种原因,我没有对我的代码进行任何更改,现在在 Android 上测试我的 React Native 时出现以下错误。我已经在我电脑上的安卓模拟器和连接到我电脑的安卓设备上都试过了。

在今天之前,它在 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 应用程序中的代码完全相同,我所做的唯一更改是删除了应用程序和单元 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/test-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

关于android - Admob 加载失败,错误为 "at nativeToJSError"- React Native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54937260/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com