flutter: google_mobile_ads is not displayed

Viewed 39

When I try to use google_mobile_ads, I get the following text and it does not work. I also tried using adMob_flutter and that one worked fine.

Unhandled Exception: MissingPluginException(No implementation found for method MobileAds#initialize on channel plugins.flutter.io/google_mobile_ads)

This is main.dart file:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  MobileAds.instance.initialize();
  runApp((myApp()));
}

How can I solve this problem?

2 Answers

I was facing the same issue. What I did is wrap everything in MaterialApp and put routes on my main Widget.

runApp( 
MaterialApp( 
routes: 
<String, WidgetBuilder>
{ '/': (BuildContext context) => 
MyApp()}
,)
,);

As for how this works, I don't know how it fix everything but it might help you

I solved this problem to delite admob_flutter pub and reinstall pod. Thanks for the answer.

Related