Plugin to integrate native firebase admob to Flutter application

Overview

pub package

flutter_native_admob

Plugin to integrate Firebase Native Admob to Flutter application Platform supported: iOS, Android

Getting Started

For help getting started with Flutter, view our online documentation.

Setup Android project

  1. Add the classpath to the [project]/android/build.gradle file.
dependencies {
  // Example existing classpath
  classpath 'com.android.tools.build:gradle:3.2.1'
  // Add the google services classpath
  classpath 'com.google.gms:google-services:4.3.0'
}
  1. Add the apply plugin to the [project]/android/app/build.gradle file.
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
  1. Add your Admob App ID.

Important: This step is required as of Google Mobile Ads SDK version 17.0.0. Failure to add this tag results in a crash with the message: The Google Mobile Ads SDK was initialized incorrectly.

<manifest>
  <application>
    <!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
    <meta-data
      android:name="com.google.android.gms.ads.APPLICATION_ID"
      android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
  </application>
</manifest>

Setup iOS project

  1. Add Admob App ID:

Important: This step is required as of Google Mobile Ads SDK version 7.42.0. Failure to add add this Info.plist entry results in a crash with the message: The Google Mobile Ads SDK was initialized incorrectly.

In your app's Info.plist file, add a GADApplicationIdentifier key with a string value of your AdMob app ID. You can find your App ID in the AdMob UI.

You can make this change programmatically:

<key>GADApplicationIdentifier</key>
<string>Your_Admob_App_ID</string>
  1. Add embeded view support:

In your app's Info.plist file, add this

<key>io.flutter.embedded_views_preview</key>
<true/>

How it works

NativeAdmob is a Flutter widget, so you can add it anywhere in Flutter application.

Property Description Type
adUnitID Your ad unit ID to load String
numberAds Number of ads to load Int
loading A widget to show when the ad is loading Widget
error A widget to show when the ad got error Widget
options Native ad styling options NativeAdmobOptions
type Native ad type (banner or full) NativeAdmobType.full
controller Controller for controlling the NativeAdmob widget NativeAdmobController

NativeAdmobOptions

Property Description Type Default value
showMediaContent Whether to show the media content or not bool true
ratingColor Rating star color Color Colors.yellow
adLabelTextStyle The ad label on the top left corner NativeTextStyle fontSize: 12, color: Colors.white, backgroundColor: Color(0xFFFFCC66)
headlineTextStyle The ad headline title NativeTextStyle fontSize: 16, color: Colors.black
advertiserTextStyle Identifies the advertiser. For example, the advertiser’s name or visible URL. (below headline) NativeTextStyle fontSize: 14, color: Colors.black
bodyTextStyle The ad description NativeTextStyle fontSize: 12, color: Colors.grey
storeTextStyle The app store name. For example, "App Store". NativeTextStyle fontSize: 12, color: Colors.black
priceTextStyle String representation of the app's price. NativeTextStyle fontSize: 12, color: Colors.black
callToActionStyle Text that encourages user to take some action with the ad. For example "Install". NativeTextStyle fontSize: 15, color: Colors.white, backgroundColor: Color(0xFF4CBE99)

NativeTextStyle

Property Description Type
fontSize Text font size double
color Text color Color
backgroundColor Background color Color
isVisible Whether to show or not bool

NativeAdmobController

Property/Function Description Type
stateChanged Stream that notify each time the loading state changed Stream
void setAdUnitID(String adUnitID) Change the ad unit ID, it will load the ad again if the id is changed from previous
void reloadAd({bool forceRefresh = false, int numberAds = 1}) Reload the ad with optionals number of ads
void setTestDeviceIds(List ids) Add your test devices
void setNonPersonalizedAds(bool nonPersAds) Set the option to disable the personalized Ads. AdMob default option: personalized

Examples

Default

NativeAdmob(
  adUnitID: "<Your ad unit ID>"
)

Using controller, loading, error widget, type and options

final _controller = NativeAdmobController();

// Optional: enter your test device ids here
_controller.setTestDeviceIds([
  "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
]);

// Optional: Set the option to disable the personalized Ads. AdMob default option: personalized
_controller.setNonPersonalizedAds(true);

NativeAdmob(
  adUnitID: "<Your ad unit ID>",
  loading: Center(child: CircularProgressIndicator()),
  error: Text("Failed to load the ad"),
  controller: _controller,
  type: NativeAdmobType.full,
  options: NativeAdmobOptions(
    ratingColor: Colors.red,
    // Others ...
  ),
)

Hide the ad until it load completed

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_native_admob/flutter_native_admob.dart';
import 'package:flutter_native_admob/native_admob_controller.dart';

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _adUnitID = "<Your ad unit ID>";

  final _nativeAdController = NativeAdmobController();
  double _height = 0;

  StreamSubscription _subscription;

  @override
  void initState() {
    _subscription = _nativeAdController.stateChanged.listen(_onStateChanged);
    super.initState();
  }

  @override
  void dispose() {
    _subscription.cancel();
    _nativeAdController.dispose();
    super.dispose();
  }

  void _onStateChanged(AdLoadState state) {
    switch (state) {
      case AdLoadState.loading:
        setState(() {
          _height = 0;
        });
        break;

      case AdLoadState.loadCompleted:
        setState(() {
          _height = 330;
        });
        break;

      default:
        break;
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: ListView(
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              height: _height,
              padding: EdgeInsets.all(10),
              margin: EdgeInsets.only(bottom: 20.0),
              child: NativeAdmob(
                // Your ad unit id
                adUnitID: _adUnitID,
                controller: _nativeAdController,

                // Don't show loading widget when in loading state
                loading: Container(),
              ),
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
          ],
        ),
      ),
    );
  }
}

Prevent ad from reloading on ListView/GridView

When putting NativeAdmob in ListView/GridView, it will keep reloading as the PlatformView init again when scrolling to the item. To prevent from reloading and take full control of the NativeAdmob, we can create NativeAdmobController and keep it

import 'package:flutter/material.dart';
import 'package:flutter_native_admob/flutter_native_admob.dart';
import 'package:flutter_native_admob/native_admob_controller.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  static const _adUnitID = "<Your ad unit ID>";

  final _controller = NativeAdmobController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: ListView(
          children: <Widget>[
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              height: 330,
              padding: EdgeInsets.all(10),
              margin: EdgeInsets.only(bottom: 20.0),
              child: NativeAdmob(
                adUnitID: _adUnitID,
                controller: _controller,
              ),
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              margin: EdgeInsets.only(bottom: 20.0),
              height: 200.0,
              color: Colors.green,
            ),
            Container(
              height: 330,
              padding: EdgeInsets.all(10),
              margin: EdgeInsets.only(bottom: 20.0),
              child: NativeAdmob(
                adUnitID: _adUnitID,
                controller: _controller,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
Comments
  • NativeAdmob doesn't show properly in ListView

    NativeAdmob doesn't show properly in ListView

    Hi,

    I'm using your example to prevent the ad to reload in a ListView, on first load everythings fine, but when I scroll and come back to the ad it doesn't show properly.

    I'm using a NativeAdmobController like mentionned, tried to reloadAd() and different things without success.

    I noticed this behavior on Android (didn't tried on iOS yet). Both emulator and real device.

    Capture1 Capture2

    opened by a-leblond 14
  • I can't load banner

    I can't load banner

    First, congratulate on his work, I find this package very interesting. I have one problem with NativeAdmobBannerView, i implement this in mi example api, and i can't load the banner , only i can see load circle.

    I am use appID to test:

    final _nativeAdmob = NativeAdmob(); _nativeAdmob.initialize(appID: 'ca-app-pub-3940256099942544~3347511713');

            NativeAdmobBannerView(
              adUnitID: 'ca-app-pub-3940256099942544/6300978111',
              style: BannerStyle.light, // enum dark or light
              showMedia: true, // whether to show media view or not
              contentPadding: EdgeInsets.fromLTRB(8.0, 8.0, 8.0, 0.0), // content padding
            )
    

    Regards,

    opened by jesusgear2 12
  • Memory Issue

    Memory Issue

    While testing on iOS, I found out that these ads consume so much memory. After listing 10-20 ads in the list view, it takes up to 1gb memory and eventually, the app crashes with error "Message from debugger: Terminated due to memory issue". Can you please check for memory leaks or possible fixes regarding this issue?

    Thank you for taking the time to maintain this package.

    opened by yalcinozdemir 7
  • Ads in Listview.builder are reloading while scrolling the list up and down

    Ads in Listview.builder are reloading while scrolling the list up and down

    Ads in Listview.builder are reloading while scrolling the list up and down. I used ads() method in a listview.builder with a controller.

    Sample code

     final _nativeAdMobController = NativeAdmobController();
     StreamSubscription _nativeAdMobSubscription;
     double _height = 0;
    
    @override
      void initState() {
       _nativeAdMobSubscription = _nativeAdMobController.stateChanged.listen(_onStateChanged);
        super.initState();
      }
    
    @override
      void dispose() {
        _nativeAdMobSubscription.cancel();
       _nativeAdMobController.dispose();
        super.dispose();
      }
    
    ads () {
        return NativeAdmob(
          adUnitID: getBannerAdUnitId(),
          loading: Container(),
         controller: _nativeAdMobController,
          type: NativeAdmobType.banner,
          options: NativeAdmobOptions(
              adLabelTextStyle: NativeTextStyle(isVisible: false),
          ),
        );
      }
    
      void _onStateChanged(AdLoadState state) {
        switch (state) {
          case AdLoadState.loading:
            setState(() {
              _height = 0;
            });
            break;
    
          case AdLoadState.loadCompleted:
            setState(() {
              _height = 80;
            });
            break;
          default:
            break;
        }
      }
    
    opened by hkndzdr 6
  • Question: is it possible to preload

    Question: is it possible to preload

    Hi, thank you for your amazing work. I use your plugin in a ListView like your example, but is it possible to preload the ads for example in the initState or elsewhere? I dont want my users to see the loading spinner. Again, thank you for your work.

    opened by MGrashoff 6
  • Flutter Requires Kotlin Version 1.3.0

    Flutter Requires Kotlin Version 1.3.0

    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher. The following dependencies do not satisfy the required version: project ':flutter_native_admob' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

    opened by ghost 5
  • Undefined class NativeAdmobOptions

    Undefined class NativeAdmobOptions

    Thanks for this great plugin I wanted to use NativeAdmobOptions as you explained in this example but i got this error :

    Undefined class 'NativeAdmobOptions'.

    I'm using last version 2.1.0

    opened by Errechydy 4
  • AndroidX Compatibility error

    AndroidX Compatibility error

    My app works fine before adding fllutter_native_admob package, after I added the package I get this error:

    Could you help me please?

    Launching lib\main.dart on LG K430 in debug mode...
    Initializing gradle...
    Resolving dependencies...
    * Error running Gradle:
    ProcessException: Process "D:\Documentos\FlutterProjects\app_name\android\gradlew.bat" exited abnormally:
    
    > Configure project :app
    WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variant.getMergeResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
    WARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
    WARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
    
    > Configure project :flutter_native_admob
    WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
    It will be removed at the end of 2019.
    For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
    To determine what is calling variant.getJavaCompile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
             *********************************************************
    WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX.
             See https://goo.gl/CP92wY for more information on the problem and how to fix it.
             This warning prints for all Android build failures. The real root cause of the error may be unrelated.
             *********************************************************
    
    opened by d-apps 3
  • Hide the ad until it load completed doesnt work !

    Hide the ad until it load completed doesnt work !

    Hello , Thanks for amazing work . My issue is , I can't get the "Hide the ad until it load completed" to work. I've tried everything ! I think the _subscription = _nativeAdController.stateChanged.listen(_onStateChanged); line doesnt work because i tried to put a print('test') inside case AdLoadState.loading: setState(() { _height = 0; //print('test'); }); but it wont print anything to the console. also the height doesn't change .stays 0. if i change the height to 330 manually it shows the ad. What am I doing wrong? thanks

    opened by mahadydev 2
  • [2.0.0] NativeAdmobOptions is not overriding theme

    [2.0.0] NativeAdmobOptions is not overriding theme

    First of all, thanks for the package. Its really good.

    I am using NativeAdmobOptions for change ad theme, but its not change anything.

    My NativeAdmobOptions (show media works but styles not working)

    NativeAdmob(
            adUnitID: "ca-app-pub-3940256099942544/2247696110", // Google native unit id for test
            options: NativeAdmobOptions(
              ratingColor: Colors.red,
              headlineTextStyle: NativeTextStyle(color: Colors.red),
              bodyTextStyle: NativeTextStyle(color: Colors.red),
            ),
          ),
    

    Result: image

    opened by devibrahimkarahan 2
  • Question about smart banners

    Question about smart banners

    Hello,

    First of all thank you for your plugin but I have a question : is your plugin able to display smart ad banner. And if so, will the widget height adapt itself ?

    Thanks.

    opened by Skyost 2
  • Getting a bunch of errors when trying to load a Native ad

    Getting a bunch of errors when trying to load a Native ad

    I am using this package in my project and it worked initially but now I am getting a bunch of error after the progress bar disappears

    PlatformException (PlatformException(error, Binary XML file line #5 in com.opeyemi.freemind:layout/native_admob_banner_view: Binary XML file line #5 in com.opeyemi.freemind:layout/native_admob_banner_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView, null, android.view.InflateException: Binary XML file line #5 in com.opeyemi.freemind:layout/native_admob_banner_view: Binary XML file line #5 in com.opeyemi.freemind:layout/native_admob_banner_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView
    Caused by: android.view.InflateException: Binary XML file line #5 in com.opeyemi.freemind:layout/native_admob_banner_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView
    
    opened by OpeyemiSanusi 2
  • BUILD FAILED Xcode

    BUILD FAILED Xcode

    Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ /Users/neolab/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:25:28: error: cannot find type 'GADUnifiedNativeAd' in scope var nativeAdChanged: ((GADUnifiedNativeAd?) -> Void)? ^~~~~~~~~~~~~~~~~~ /Users/neolab/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:26:19: error: cannot find type 'GADUnifiedNativeAd' in scope var nativeAd: GADUnifiedNativeAd? { ^~~~~~~~~~~~~~~~~~ /Users/neolab/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:108:34: error: cannot find type 'GADUnifiedNativeAdLoaderDelegate' in scope extension NativeAdmobController: GADUnifiedNativeAdLoaderDelegate { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/neolab/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:110:79: error: cannot find type 'GADRequestError' in scope func adLoader(_ adLoader: GADAdLoader, didFailToReceiveAdWithError error: GADRequestError) { ^~~~~~~~~~~~~~~

    opened by padgithub 1
  • allocator 3.x is not supported

    allocator 3.x is not supported

    I am running an example from the main page of the package (the code that goes below "Prevent ad from reloading on ListView/GridView") and am getting an error "allocator 3.x is not supported". I used google-services.json created with a new Firebase project today (May 3, 2021) and configured both build.gradle files and manifest with the configuration suggested by the main package page.

    Here is the complete stack trace:

    Running "flutter pub get" in test_admob_native... Launching lib\main.dart on sdk gphone x86 in debug mode... Running Gradle task 'assembleDebug'... √ Built build\app\outputs\flutter-apk\app-debug.apk. Installing build\app\outputs\flutter-apk\app.apk... Debug service listening on ws://127.0.0.1:54669/qQvCX21v12A=/ws Syncing files to device sdk gphone x86... I/st_admob_nativ( 8474): The ClassLoaderContext is a special shared library. I/st_admob_nativ( 8474): The ClassLoaderContext is a special shared library. I/DynamiteModule( 8474): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:210890500 I/DynamiteModule( 8474): Selected remote version of com.google.android.gms.ads.dynamite, version >= 210890500 D/DynamitePackage( 8474): Instantiated singleton DynamitePackage. D/DynamitePackage( 8474): Instantiating com.google.android.gms.ads.ChimeraAdLoaderBuilderCreatorImpl I/Ads ( 8474): This request is sent from a test device. I/DynamiteModule( 8474): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:210890500 I/DynamiteModule( 8474): Selected remote version of com.google.android.gms.ads.dynamite, version >= 210890500 W/Parcel ( 8474): **** enforceInterface() expected 'com.google.android.gms.ads.clearcut.IClearcut' but read 'com.google.android.gms.gass.internal.clearcut.IClearcut' I/WebViewFactory( 8474): Loading com.google.android.webview version 83.0.4103.106 (code 410410681) I/st_admob_nativ( 8474): The ClassLoaderContext is a special shared library. D/nativeloader( 8474): classloader namespace configured for unbundled product apk. library_path=/product/app/WebViewGoogle/lib/x86:/product/app/WebViewGoogle/WebViewGoogle.apk!/lib/x86:/product/app/TrichromeLibrary/TrichromeLibrary.apk!/lib/x86:/product/lib:/system/product/lib I/DynamiteModule( 8474): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:210890500 I/DynamiteModule( 8474): Selected remote version of com.google.android.gms.ads.dynamite, version >= 210890500 W/Parcel ( 8474): **** enforceInterface() expected 'com.google.android.gms.ads.clearcut.IClearcut' but read 'com.google.android.gms.gass.internal.clearcut.IClearcut' I/st_admob_nativ( 8474): The ClassLoaderContext is a special shared library. D/nativeloader( 8474): classloader namespace configured for unbundled product apk. library_path=/product/app/WebViewGoogle/lib/x86:/product/app/WebViewGoogle/WebViewGoogle.apk!/lib/x86:/product/app/TrichromeLibrary/TrichromeLibrary.apk!/lib/x86:/product/lib:/system/product/lib I/cr_LibraryLoader( 8474): Loaded native library version number "83.0.4103.106" I/cr_CachingUmaRecorder( 8474): Flushed 3 samples from 3 histograms. I/DynamiteModule( 8474): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:210890500 I/DynamiteModule( 8474): Selected remote version of com.google.android.gms.ads.dynamite, version >= 210890500 E/chromium( 8474): [ERROR:filesystem_posix.cc(62)] mkdir /data/user/0/com.example.test_admob_native/cache/WebView/Crashpad: No such file or directory (2) W/st_admob_nativ( 8474): Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (greylist, reflection, allowed) W/cr_media( 8474): Requires BLUETOOTH permission D/HostConnection( 8474): HostConnection::get() New Host Connection established 0xf1b58180, tid 8631 D/HostConnection( 8474): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 D/EGL_emulation( 8474): eglCreateContext: 0xf1b5dc80: maj 3 min 0 rcv 3 D/EGL_emulation( 8474): eglMakeCurrent: 0xf1b5dc80: ver 3 0 (tinfo 0xaf9d1450) (first time) I/VideoCapabilities( 8474): Unsupported profile 4 for video/mp4v-es W/cr_MediaCodecUtil( 8474): HW encoder for video/avc is not available on this device. D/EGL_emulation( 8474): eglCreateContext: 0xf1b65a10: maj 3 min 0 rcv 3 I/DynamiteModule( 8474): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:210890500 I/DynamiteModule( 8474): Selected remote version of com.google.android.gms.ads.dynamite, version >= 210890500 E/MethodChannel#flutter/platform_views( 8474): Failed to handle method call E/MethodChannel#flutter/platform_views( 8474): android.view.InflateException: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView E/MethodChannel#flutter/platform_views( 8474): Caused by: android.view.InflateException: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView E/MethodChannel#flutter/platform_views( 8474): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.ads.formats.UnifiedNativeAdView E/MethodChannel#flutter/platform_views( 8474): at java.lang.Class.classForName(Native Method) E/MethodChannel#flutter/platform_views( 8474): at java.lang.Class.forName(Class.java:454) E/MethodChannel#flutter/platform_views( 8474): at android.view.LayoutInflater.createView(LayoutInflater.java:813) E/MethodChannel#flutter/platform_views( 8474): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004) E/MethodChannel#flutter/platform_views( 8474): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) E/MethodChannel#flutter/platform_views( 8474): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121) E/MethodChannel#flutter/platform_views( 8474): at android.view.LayoutInflater.inflate(LayoutInflater.java:654) E/MethodChannel#flutter/platform_views( 8474): at android.view.LayoutInflater.inflate(LayoutInflater.java:532) E/MethodChannel#flutter/platform_views( 8474): at com.nover.flutternativeadmob.NativeAdView.(NativeAdView.kt:52) E/MethodChannel#flutter/platform_views( 8474): at com.nover.flutternativeadmob.NativeAdView.(NativeAdView.kt:23) E/MethodChannel#flutter/platform_views( 8474): at com.nover.flutternativeadmob.NativePlatformView.(FlutterNativeAdmobPlugin.kt:97) E/MethodChannel#flutter/platform_views( 8474): at com.nover.flutternativeadmob.ViewFactory.create(FlutterNativeAdmobPlugin.kt:76) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:186) E/MethodChannel#flutter/platform_views( 8474): at android.app.Dialog.dispatchOnCreate(Dialog.java:419) E/MethodChannel#flutter/platform_views( 8474): at android.app.Dialog.show(Dialog.java:313) E/MethodChannel#flutter/platform_views( 8474): at android.app.Presentation.show(Presentation.java:257) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.plugin.platform.VirtualDisplayController.(VirtualDisplayController.java:95) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:48) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:207) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/MethodChannel#flutter/platform_views( 8474): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) E/MethodChannel#flutter/platform_views( 8474): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#flutter/platform_views( 8474): at android.os.MessageQueue.next(MessageQueue.java:335) E/MethodChannel#flutter/platform_views( 8474): at android.os.Looper.loop(Looper.java:183) E/MethodChannel#flutter/platform_views( 8474): at android.app.ActivityThread.main(ActivityThread.java:7656) E/MethodChannel#flutter/platform_views( 8474): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#flutter/platform_views( 8474): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/MethodChannel#flutter/platform_views( 8474): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/MethodChannel#flutter/platform_views( 8474): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.formats.UnifiedNativeAdView" on path: DexPathList[[zip file "/data/app/~~ag7CeNjDdeFXTTzqMdfKUA==/com.example.test_admob_native-ZbRTeVJUlrbiSSepVR29Yw==/base.apk"],nativeLibraryDirectories=[/data/app/~~ag7CeNjDdeFXTTzqMdfKUA==/com.example.test_admob_native-ZbRTeVJUlrbiSSepVR29Yw==/lib/x86, /data/app/~~ag7CeNjDdeFXTTzqMdfKUA==/com.example.test_admob_native-ZbRTeVJUlrbiSSepVR29Yw==/base.apk!/lib/x86, /system/lib, /system_ext/lib]] E/MethodChannel#flutter/platform_views( 8474): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) E/MethodChannel#flutter/platform_views( 8474): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/MethodChannel#flutter/platform_views( 8474): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/MethodChannel#flutter/platform_views( 8474): ... 31 more E/flutter ( 8474): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(error, Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView, null, android.view.InflateException: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView E/flutter ( 8474): Caused by: android.view.InflateException: Binary XML file line #5 in com.example.test_admob_native:layout/native_admob_full_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView E/flutter ( 8474): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.ads.formats.UnifiedNativeAdView E/flutter ( 8474): at java.lang.Class.classForName(Native Method) E/flutter ( 8474): at java.lang.Class.forName(Class.java:454) E/flutter ( 8474): at android.view.LayoutInflater.createView(LayoutInflater.java:813) E/flutter ( 8474): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1004) E/flutter ( 8474): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959) E/flutter ( 8474): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121) E/flutter ( 8474): at android.view.LayoutInflater.inflate(LayoutInflater.java:654) E/flutter ( 8474): at android.view.LayoutInflater.inflate(LayoutInflater.java:532) E/flutter ( 8474): at com.nover.flutternativeadmob.NativeAdView.(NativeAdView.kt:52) E/flutter ( 8474): at com.nover.flutternativeadmob.NativeAdView.(NativeAdView.kt:23) E/flutter ( 8474): at com.nover.flutternativeadmob.NativePlatformView.(FlutterNativeAdmobPlugin.kt:97) E/flutter ( 8474): at com.nover.flutternativeadmob.ViewFactory.create(FlutterNativeAdmobPlugin.kt:76) E/flutter ( 8474): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:186) E/flutter ( 8474): at android.app.Dialog.dispatchOnCreate(Dialog.java:419) E/flutter ( 8474): at android.app.Dialog.show(Dialog.java:313) E/flutter ( 8474): at android.app.Presentation.show(Presentation.java:257) E/flutter ( 8474): at io.flutter.plugin.platform.VirtualDisplayController.(VirtualDisplayController.java:95) E/flutter ( 8474): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:48) E/flutter ( 8474): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:207) E/flutter ( 8474): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104) E/flutter ( 8474): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59) E/flutter ( 8474): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/flutter ( 8474): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/flutter ( 8474): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818) E/flutter ( 8474): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter ( 8474): at android.os.MessageQueue.next(MessageQueue.java:335) E/flutter ( 8474): at android.os.Looper.loop(Looper.java:183) E/flutter ( 8474): at android.app.ActivityThread.main(ActivityThread.java:7656) E/flutter ( 8474): at java.lang.reflect.Method.invoke(Native Method) E/flutter ( 8474): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/flutter ( 8474): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/flutter ( 8474): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.formats.UnifiedNativeAdView" on path: DexPathList[[zip file "/data/app/~~ag7CeNjDdeFXTTzqMdfKUA==/com.example.test_admob_native-ZbRTeVJUlrbiSSepVR29Yw==/base.apk"],nativeLibraryDirectories=[/data/app/~~ag7CeNjDdeFXTTzqMdfKUA==/com.example.test_admob_native-ZbRTeVJUlrbiSSepVR29Yw==/lib/x86, /data/app/~~ag7CeNjDdeFXTTzqMdfKUA==/com.example.test_admob_native-ZbRTeVJUlrbiSSepVR29Yw==/base.apk!/lib/x86, /system/lib, /system_ext/lib]] E/flutter ( 8474): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207) E/flutter ( 8474): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/flutter ( 8474): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/flutter ( 8474): ... 31 more E/flutter ( 8474): ) E/flutter ( 8474): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581:7) E/flutter ( 8474): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158:18) E/flutter ( 8474): E/flutter ( 8474): #2 TextureAndroidViewController._sendCreateMessage (package:flutter/src/services/platform_views.dart:1036:18) E/flutter ( 8474): E/flutter ( 8474): #3 AndroidViewController.create (package:flutter/src/services/platform_views.dart:742:5) E/flutter ( 8474): E/flutter ( 8474): #4 RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:195:7) E/flutter ( 8474): E/flutter ( 8474): W/Gralloc4( 8474): allocator 3.x is not supported

    Flutter doctor:

    C:\flutter\bin\flutter.bat doctor --verbose [√] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.928], locale en-US) • Flutter version 2.0.6 at C:\flutter • Framework revision 1d9032c7e1 (4 days ago), 2021-04-29 17:37:58 -0700 • Engine revision 05e680e202 • Dart version 2.12.3

    [√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users<Name>\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.

    [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

    [√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

    [√] IntelliJ IDEA Community Edition (version 2020.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.2 • Flutter plugin version 54.0.3 • Dart plugin version 203.7759

    [√] Connected device (4 available) • Pixel 5 (mobile) • 07201FDD40007C • android-arm64 • Android 11 (API 30) • sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator) • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93 • Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.68

    • No issues found! Process finished with exit code 0

    I also tried to disable video ads from the AdMob configuration page and to keep images only. The error persists.

    The screen looks the following. Screenshot_20210503_214922

    Could you please suggest any fix for this?

    Thank you.

    opened by shelpuk 0
Owner
Duy Duong
Duy Duong
Admob Flutter plugin that shows banner ads using native platform views.

Looking for Maintainers. Unfortunately I haven't been able to keep up with demand for features and improvments. If you are interested in helping maint

Kevin McGill 418 Dec 3, 2022
Easy-to-make native ads in flutter using AdMOB SDK.

native_admob_flutter Easy-to-make ads in Flutter with Google's AdMob SDK. English | Português Get started To get started with Native Ads for Flutter,

Bruno D'Luka 81 Dec 12, 2022
Plugin to integrate Facebook Native Banner Ad

flutter_fbaudience_network Plugin to integrate Facebook Native Ad to Flutter application Warning: The plugin is based on Flutter PlatformView (Android

Duy Duong 8 May 13, 2020
A Sample Flutter project to show how to integrate native kotlin code with flutter

kotlin_flashlight A Sample Flutter project to show how to integrate native kotlin code with flutter. Getting Started Visit this docs for Flutter setup

null 0 Apr 4, 2022
dna, dart native access. A lightweight dart to native super channel plugin

dna, dart native access. A lightweight dart to native super channel plugin, You can use it to invoke any native code directly in contextual and chained dart code.

Assuner 14 Jul 11, 2022
how to Integrating facebook audience network to flutter app for banner, interstitial, rewarded, native and native banner

fb_ads_flutter_12 A new Flutter project. Getting Started Watch the complite tutorial for integrating Facebook ads into the Flutter app in our Youtube

null 4 Nov 26, 2022
react-native native module for In App Purchase.

Documentation Published in website. Announcement Version 8.0.0 is currently in release candidate. The module is completely rewritten with Kotlin and S

dooboolab 2.3k Dec 31, 2022
A Note app built with flutter and integrate with Firebase for user authentication and backend database.

Note App Note app (Both frontend and backend) created with Flutter and Firebase. Complete UI Contains Sign in & Sign up Home Screen Setting screen Acc

Hafiz Mounim Naeem 6 Dec 4, 2022
Flutter plugin to simply integrate Agora Video Calling or Live Video Streaming to your app with just a few lines of code.

Agora UI Kit for Flutter Instantly integrate Agora video calling or video streaming into your Flutter application. Getting started Requirements An Ago

Agora.io Community 106 Dec 16, 2022
Flutter plugin for Firebase Auth UI. Supports popular auth providers by using native SDK for Android and iOS.

firebase_auth_ui Flutter plugin of Firebase UI which allows to add login/sign-up quickly. NOTE: This plugin is under development. Please provide Feedb

Sandip Fichadiya 50 Mar 23, 2022
The LoginRadius Flutter SDK will let you integrate LoginRadius' customer identity platform with your Flutter application(s).

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Ahmed Yusuf 4 Feb 3, 2022
In this video we will learn how to Integrate NodeJS Login and Register API in our Flutter application using JWT Token Authentication.

Flutter Login & Register with Node JS Rest API In this video we will learn how to Integrate NodeJS Login and Register API in our Flutter application u

SnippetCoder 18 Nov 28, 2022
A most easily usable RESAS API wrapper in Dart. With this library, you can easily integrate your application with the RESAS API.

A most easily usable RESAS API wrapper library in Dart! 1. About 1.1. What Is RESAS? 1.2. Introduction 1.2.1. Install Library 1.2.2. Import It 1.2.3.

Kato Shinya 2 Apr 7, 2022
Buy me crypto coffee - A Flutter package that helps you to integrate Buy me a crypto coffee widget in flutter

Buy me a crypto coffee Features A Flutter package that helps you to integrate Bu

Anto Tom Abraham 2 Nov 25, 2022
Integrate Flutter with the Facebook Stetho tool for Android

flutter_stetho A plugin that connects Flutter to the Chrome Dev Tools on Android devices via the Stetho Android Library. Network Inspector The main fe

Brian Egan 215 Nov 20, 2022
Integrate any icons you like to your flutter app

Flutter Tutorial - Icons - Custom & Plugin Icons Integrate any icons you like to your flutter app - Material Icons, Beautiful Icons & Custom Icons. ⚡

Behruz Hurramov 1 Dec 28, 2021
Easily integrate GitHub's Octicons in your own Flutter project

flutter_octicons Use the Octicon icons developed by GitHub and released under the MIT license in Flutter. flutter_octicons automatically updates itsel

Rubin Raithel 6 Nov 21, 2022
Flutter project to Integrate API resources from JSON Place Holder API

rest_api_jsonplaceholder About This flutter project helps to Integrate API resources from JSON Place Holder API API Source: https://jsonplaceholder.ty

null 0 Apr 28, 2022
This library provides the easiest way to integrate Twitter Cards in Flutter web apps 🐦

The Easiest Way to Integrate Twitter Cards into Your Flutter Web App ?? 1. Guide ?? 1.1. Features ?? 1.2. Getting Started ⚡ 1.2.1. Install Library 1.2

Twitter.dart 3 Aug 7, 2022