flutter_native_admob
flutter_native_admob copied to clipboard
I get a ClassNotFoundException when using flutter_native_admob
When the App tries to display the ad i get an ClassNotFoundException:
E/MethodChannel#flutter/platform_views( 6591): android.view.InflateException: Binary XML file line #5 in com.araapp.ara_app:layout/native_admob_banner_view: Binary XML file line #5 in com.araapp.ara_app:layout/native_admob_banner_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView
E/MethodChannel#flutter/platform_views( 6591): Caused by: android.view.InflateException: Binary XML file line #5 in com.araapp.ara_app:layout/native_admob_banner_view: Error inflating class com.google.android.gms.ads.formats.UnifiedNativeAdView
E/MethodChannel#flutter/platform_views( 6591): Caused by: java.lang.ClassNotFoundException: com.google.android.gms.ads.formats.UnifiedNativeAdView
E/MethodChannel#flutter/platform_views( 6591): at java.lang.Class.classForName(Native Method)
E/MethodChannel#flutter/platform_views( 6591): at java.lang.Class.forName(Class.java:454)
E/MethodChannel#flutter/platform_views( 6591): at android.view.LayoutInflater.createView(LayoutInflater.java:815)
E/MethodChannel#flutter/platform_views( 6591): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1006)
E/MethodChannel#flutter/platform_views( 6591): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961)
E/MethodChannel#flutter/platform_views( 6591): at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
E/MethodChannel#flutter/platform_views( 6591): at android.view.LayoutInflater.inflate(LayoutInflater.java:656)
E/MethodChannel#flutter/platform_views( 6591): at android.view.LayoutInflater.inflate(LayoutInflater.java:534)
E/MethodChannel#flutter/platform_views( 6591): at com.nover.flutternativeadmob.NativeAdView.<init>(NativeAdView.kt:52)
E/MethodChannel#flutter/platform_views( 6591): at com.nover.flutternativeadmob.NativeAdView.<init>(NativeAdView.kt:23)
E/MethodChannel#flutter/platform_views( 6591): at com.nover.flutternativeadmob.NativePlatformView.<init>(FlutterNativeAdmobPlugin.kt:97)
E/MethodChannel#flutter/platform_views( 6591): at com.nover.flutternativeadmob.ViewFactory.create(FlutterNativeAdmobPlugin.kt:76)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:186)
E/MethodChannel#flutter/platform_views( 6591): at android.app.Dialog.dispatchOnCreate(Dialog.java:421)
E/MethodChannel#flutter/platform_views( 6591): at android.app.Dialog.show(Dialog.java:315)
E/MethodChannel#flutter/platform_views( 6591): at android.app.Presentation.show(Presentation.java:250)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:95)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:48)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:207)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#flutter/platform_views( 6591): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#flutter/platform_views( 6591): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#flutter/platform_views( 6591): at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#flutter/platform_views( 6591): at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#flutter/platform_views( 6591): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#flutter/platform_views( 6591): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#flutter/platform_views( 6591): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#flutter/platform_views( 6591): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/MethodChannel#flutter/platform_views( 6591): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.formats.UnifiedNativeAdView" on path: DexPathList[[zip file "/data/app/com.araapp.ara_app-QtmvM_hijlpxjPpcLK-2yA==/base.apk"],nativeLibraryDirectories=[/data/app/com.araapp.ara_app-QtmvM_hijlpxjPpcLK-2yA==/lib/x86, /data/app/com.araapp.ara_app-QtmvM_hijlpxjPpcLK-2yA==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
E/MethodChannel#flutter/platform_views( 6591): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
E/MethodChannel#flutter/platform_views( 6591): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/MethodChannel#flutter/platform_views( 6591): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/MethodChannel#flutter/platform_views( 6591): ... 31 more
I am using version flutter_native_admob: "2.1.0+3" i have these dependencies in the android/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.0'
}
i have the apply plugin at the end of the app/build.gradle: apply plugin: 'com.google.gms.google-services' and i have a correct APPLICATION_ID in the Android Manifest and a valid adUnitID for the nativeAd am i still missing something?
Facing same issue here !🤔🧐
Hi @d0mmi, are you using google_mobile_ads package in your app?
Hi @d0mmi, are you using google_mobile_ads package in your app?
no, should i? i use:
expandable: ^5.0.1
awesome_dialog:
titled_navigation_bar: ^4.1.0
http: 0.13.0
cached_network_image:
shared_preferences:
swipe_stack: ^1.0.0
firebase_core:
firebase_analytics:
flutter_native_admob: "2.1.0+3"
carousel_slider: ^2.2.1
Hi @d0mmi, are you using google_mobile_ads package in your app?
no, should i? i use:
expandable: ^5.0.1 awesome_dialog: titled_navigation_bar: ^4.1.0 http: 0.13.0 cached_network_image: shared_preferences: swipe_stack: ^1.0.0 firebase_core: firebase_analytics: flutter_native_admob: "2.1.0+3" carousel_slider: ^2.2.1
You can use it for native ads, its just complex as compared to what you will be doing with this package but it works. You can use it.
You can use it for native ads, its just complex as compared to what you will be doing with this package but it works. You can use it.
Yeah i wanted to avoid that, but if i can not fix this error i will switch to that
@d0mmi hi bro, i have the same problem here.... How you fixed it?
@d0mmi hi bro, i have the same problem here.... How you fixed it?
I could not fix it
@d0mmi, @ramonpaolo @hussam132 There are plenty of forks where this problem (and some others) are fixed. You can try from my copy.
@d0mmi, @ramonpaolo @hussam132 There are plenty of forks where this problem (and some others) are fixed. You can try from my copy.
hi @hicnar thank you, this fix my problem :D