0

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?

Hamed
  • 5,867
  • 4
  • 32
  • 56
wasa-bi
  • 71
  • 7

2 Answers2

1

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

Adil Shinwari
  • 408
  • 2
  • 10
0

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

wasa-bi
  • 71
  • 7
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 17 '22 at 01:42