3

I am trying to add native ads using the plugin flutter_native_admob but I always get this error:

E/flutter ( 6504): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel flutter_native_admob)
E/flutter ( 6504): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
E/flutter ( 6504): <asynchronous suspension>
E/flutter ( 6504): #1      NativeAdmob.initialize (package:flutter_native_admob/flutter_native_admob.dart:105:20)
E/flutter ( 6504): #2      HomePageState.initState (package:spanglishcards/view/card/HomePage.dart:67:19)
E/flutter ( 6504): #3      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)

I tried to add it in my Home page:

class HomePage extends StatefulWidget {
  HomePage({
    this.user,
  });
  final User user;

  @override
  State<StatefulWidget> createState() => HomePageState();
}

class HomePageState extends State<HomePage> {
    final _nativeAdmobs = NativeAdmob();

    Future initState() {
        super.initState();
        _nativeAdmobs.initialize(appID:"ca-app-pub-XXX~XXX" );
    }
}

And also in the main.dart:

final _nativeAdmobs = NativeAdmob();

void main(){
  WidgetsFlutterBinding.ensureInitialized();
  _nativeAdmobs.initialize(appID:"ca-app-pub-XXX~XXX" );
  runApp(MyApp());
}

I also tried to run flutter clean / flutter run before just in case, but it doesn't work either. Any solution?

To discard issues with my appID, the plugin firebase_admob (doesn't support native ads) works.

Jose Antonio
  • 578
  • 1
  • 8
  • 34
  • 1
    finally I gave up and I started using the plugin firebase_admob using only banners and interstitials. I hope firebase_admob ends up supporting native ads in a easy way. – Jose Antonio Apr 23 '20 at 13:45

0 Answers0