react-native-admob
react-native-admob copied to clipboard
Error: Ad is already loaded. (Warning)
I am trying to implement Admob Rewarded, and I have code similar to the one from Example folder. Everything works great but I receive warning in console that says Error: Ad is already loaded. and another warning on the phone {"framesToTop":1",code":"E_AD_ALREADY_LOADED"}.
I receive it right after the page loads (before even clicking a button with an ad). Am I doing something wrong or should I just ignore the warning since everything is working great?
I am using 2nd version, and here the code I have:
componentDidMount() {
AdMobRewarded.setAdUnitID('XXX');
AdMobRewarded.addEventListener('rewarded',
(reward) => console.log('AdMobRewarded => rewarded', reward)
);
AdMobRewarded.addEventListener('adLoaded',
() => console.log('AdMobRewarded => adLoaded')
);
AdMobRewarded.addEventListener('adFailedToLoad',
(error) => console.warn(error)
);
AdMobRewarded.addEventListener('adOpened',
() => console.log('AdMobRewarded => adOpened')
);
AdMobRewarded.addEventListener('videoStarted',
() => console.log('AdMobRewarded => videoStarted')
);
AdMobRewarded.addEventListener('adClosed',
() => {
console.log('AdMobRewarded => adClosed');
AdMobRewarded.requestAd().catch(error => console.warn(error));
}
);
AdMobRewarded.addEventListener('adLeftApplication',
() => console.log('AdMobRewarded => adLeftApplication')
);
AdMobRewarded.requestAd().catch(error => console.warn(error));
}
componentWillUnmount() {
AdMobRewarded.removeAllListeners();
}
showRewarded() {
AdMobRewarded.showAd().catch(error => console.warn(error));
}
....
<Button
onPress={() => this.showRewarded()
}
/>
If you are using an emulator, close the app and kill it. I hope this should work.
@saravanakumargn I am using physical device and it happens every time.
I got the same error and after removing catch error handle its working fine. Please let me know if anyone got the proper solution.
AdMobRewarded.requestAd().catch(error => console.warn(error));
Does the ad load for you? When I get "Error: Ad is already loaded.", Ad doesn't want to load and I get only this warning.
try this way: AdMobRewarded.requestAd() .then(() => AdMobRewarded.showAd()) .catch(error => console.warn(error))
same here. any solutions so far?
Any update? this open the app twice. For me the action: "AdMobRewarded" works good But the problems are in: "AdMobInterstitial" and "Banner"
AdMobRewarded.requestAd().then(() => AdMobRewarded.showAd())
This will work! 👍🏻
Yes i was also facing the same problem but you can fix this issue by just copy-paste the following code
componentWillUnmount() { AdMobRewarded.removeAllListeners(); }
in react native
It only shows the Ad 1 time if i skipped/closed the Ad via "adClosed" event.
the error is
Error: Ad is already loaded.
Go to AdMobRewarded class in library folder in android folder and remove the following lines with red doodles.

await AdMobInterstitial.setAdUnitID(adUnitID.android.interstitial); // Test ID, Replace with your-admob-unit-id await AdMobInterstitial.requestAdAsync({ servePersonalizedAds: true }); await AdMobInterstitial.showAdAsync();
// ad reloaded setTimeout(() => { AdMobInterstitial.dismissAdAsync(); }, 1000);
AdMobInterstitial.setAdUnitID(adInterstitialUnitID); AdMobInterstitial.requestAdAsync({ servePersonalizedAds: true }) .then(async () => { await AdMobInterstitial.showAdAsync(); setTimeout(() => { //Here Write your code after user seen ad }, 3000); setLoading(false); }) .catch((error) => console.log(error)) .finally(() => { setTimeout(() => { AdMobInterstitial.dismissAdAsync(); }, 1000); });