Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get a ClassNotFoundException when using flutter_native_admob #91

Open
d0mmi opened this issue Apr 13, 2021 · 9 comments
Open

I get a ClassNotFoundException when using flutter_native_admob #91

d0mmi opened this issue Apr 13, 2021 · 9 comments

Comments

@d0mmi
Copy link

d0mmi commented Apr 13, 2021

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?

@ghost
Copy link

ghost commented May 12, 2021

Facing same issue here !🤔🧐

@sanchaykasturey
Copy link

Hi @d0mmi, are you using google_mobile_ads package in your app?

@d0mmi
Copy link
Author

d0mmi commented May 27, 2021

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

@sanchaykasturey
Copy link

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.

@d0mmi
Copy link
Author

d0mmi commented May 27, 2021

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

@ramonpaolo
Copy link

@d0mmi hi bro, i have the same problem here.... How you fixed it?

@d0mmi
Copy link
Author

d0mmi commented Jul 12, 2021

@d0mmi hi bro, i have the same problem here.... How you fixed it?

I could not fix it

@hicnar
Copy link

hicnar commented Sep 12, 2021

@d0mmi, @ramonpaolo @hussam132 There are plenty of forks where this problem (and some others) are fixed. You can try from my copy.

@frostextreme11
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants