this ad may have not been loaded or has been disposed. native ads
See original GitHub issueTrying to implement Native ads but it showing this error… “this ad may have not been loaded or has been disposed. Ad with the following id could not be found: 1 /6”
Java Code of android…
public class MainActivity extends FlutterActivity {
@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
super.configureFlutterEngine(flutterEngine);
final NativeAdFactory factory = new NativeAdFactoryExample(getLayoutInflater());
GoogleMobileAdsPlugin.registerNativeAdFactory(flutterEngine, "adFactoryExample", factory);
GoogleMobileAdsPlugin.registerNativeAdFactory(flutterEngine, "listTile",
new ListTileNativeAdFactory(getContext()));
}
@Override
public void cleanUpFlutterEngine(@NonNull FlutterEngine flutterEngine) {
super.cleanUpFlutterEngine(flutterEngine);
GoogleMobileAdsPlugin.unregisterNativeAdFactory(flutterEngine, "adFactoryExample");
GoogleMobileAdsPlugin.unregisterNativeAdFactory(flutterEngine, "listTile");
}
}
Do i need both listTile and adFactoryExample for Displaying Native and InlineNative?
Although i am not showing in same Page…
in HomePage showing with adFactoryExample…
NativeAd _nativeAd;
bool _nativeAdIsLoaded = false;
@override
void initState() {
super.initState();
_createInterstitialAd();
_nativeAd = NativeAd(
adUnitId: 'ca-app-pub-3940256099942544/2247696110',
request: AdRequest(),
factoryId: 'adFactoryExample',
listener: NativeAdListener(
onAdLoaded: (Ad ad) {
print('natty $NativeAd loaded.');
setState(() {
_nativeAdIsLoaded = true;
});
},
onAdFailedToLoad: (Ad ad, LoadAdError error) {
print('natty $NativeAd failedToLoad: $error');
ad.dispose();
},
),
);
_nativeAd.load();
}
Widget nAdWidget() {
final AdWidget adWidget = AdWidget(ad: _nativeAd);
return Builder(
builder: (context) => Container(
child: adWidget,
width: 250,
height: 350,
alignment: Alignment.center,
),
);
}
>>Scaffold
(
Container(.....),
...
nAdWidget(),
....,
Widget(....),
)
@override
void dispose() {
_interstitialAd?.dispose();
_nativeAd?.dispose();
super.dispose();
}
another page… Using inline native… same error…
No issues in Flutter doctor…
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Ad with the following id could not be found. Natiev Ad Flutter ...
the native ad is me show a an error. I use the Test ad id from google. "This ad may have not been...
Read more >Adding an AdMob banner and native inline ads to a Flutter app
This codelab guides you through implementing an AdMob inline banner and AdMob native inline ads in a Flutter app using the Google Mobile...
Read more >google_mobile_ads 0.13.6 | Flutter Package - Pub.dev
The Google Mobile Ads SDK for Flutter currently supports loading and displaying banner, interstitial (full-screen), native ads, and rewarded video ads.
Read more >Easy-to-make Native Ads in Flutter - Morioh
Failure to do so can lead to suspension of your account. The easiest way to load test ads is to use the dedicated...
Read more >App Open Ads | Flutter - Google Developers
The easiest way to load test ads is to use our dedicated test ad unit ... They have been specially configured to return...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same error @viniciusddrft viniciusddrft
Can you help me fix this out?
PlatformException(NativeAdError, Can't find NativeAdFactory with id: adFactoryExample, null, null)
I’m using Getx and this is my codes:controller;
widget;
Setups in Android are:
same problem ad cant be loaded