androidfacebookunity-game-engineadmobmobile-ad-mediation

Audience Network not working with Admob Mediation


I have started working on Admob Mediation in Unity recently. Using the Admob Guide i have successfully done some ad network but have now stumbled upon Audience Network which is not working for some reason, i have checked the Logcat which is following:

04-25 12:27:41.444: I/Ads(24246): Trying mediation network: https://googleads.g.doubleclick.net/aclk?sa=L&ai=CktAubWHBXJCyJsLKxgK8iJa4D_nJ2qYF0e-FupIBABAIIPaf5WNgy9y0BakCAAAAAICELkGoAwGqBCpP0JYVqjXRsTejJKRPkKjp4qtE5jVAPiRaFF77IXqeLsWUzY__-Pd2elqQBgHABguAB4H4qTCYBwGoB9nLG6gHz8wb0ggHCIABEAEYDg&num=1&cid=CAASBORoPe4&sig=AOD64_1JupFPNn7lFJJqOokofvlT0lFnhw&adurl=http://example.com
04-25 12:27:41.445: I/Ads(24246): Instantiating mediation adapter: com.google.ads.mediation.facebook.FacebookAdapter
04-25 12:27:41.447: I/zygote(24246): Rejecting re-init on previously-failed class java.lang.Class<com.google.ads.mediation.facebook.FacebookMediationAdapter>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/mediation/Adapter;
04-25 12:27:41.447: I/zygote(24246):   at java.lang.Class java.lang.Class.classForName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
04-25 12:27:41.447: I/zygote(24246):   at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:453)
04-25 12:27:41.447: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzau(java.lang.String) ((null):-1)
04-25 12:27:41.447: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzas(java.lang.String) ((null):-1)
04-25 12:27:41.447: I/zygote(24246):   at boolean com.google.android.gms.internal.zzka$zza.onTransact(int, android.os.Parcel, android.os.Parcel, int) ((null):-1)
04-25 12:27:41.447: I/zygote(24246):   at boolean android.os.Binder.transact(int, android.os.Parcel, android.os.Parcel, int) (Binder.java:622)
04-25 12:27:41.447: I/zygote(24246):   at android.os.Parcel ox.a(int, android.os.Parcel) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:2)
04-25 12:27:41.447: I/zygote(24246):   at com.google.android.gms.ads.internal.mediation.client.e com.google.android.gms.ads.internal.mediation.client.d.a(java.lang.String) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.447: I/zygote(24246):   at void com.google.android.gms.ads.internal.mediation.g.run() (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:6)
04-25 12:27:41.447: I/zygote(24246):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
04-25 12:27:41.447: I/zygote(24246):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
04-25 12:27:41.447: I/zygote(24246):   at void aai.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.447: I/zygote(24246):   at void com.google.android.gms.ads.internal.util.e.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.447: I/zygote(24246):   at void aai.dispatchMessage(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.448: I/zygote(24246):   at void android.os.Looper.loop() (Looper.java:164)
04-25 12:27:41.448: I/zygote(24246):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6798)
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-25 12:27:41.448: I/zygote(24246):   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
04-25 12:27:41.448: I/zygote(24246):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
04-25 12:27:41.448: I/zygote(24246): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.mediation.Adapter" on path: DexPathList[[zip file "/data/app/com.test.admob.mediation.to-ol90HvQyH2v8rU4_iVV7qA==/base.apk"],nativeLibraryDirectories=[/data/app/com.test.admob.mediation.to-ol90HvQyH2v8rU4_iVV7qA==/lib/arm, /data/app/com.test.admob.mediation.to-ol90HvQyH2v8rU4_iVV7qA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]]
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Class java.lang.Class.classForName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:453)
04-25 12:27:41.448: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzau(java.lang.String) ((null):-1)
04-25 12:27:41.448: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzas(java.lang.String) ((null):-1)
04-25 12:27:41.448: I/zygote(24246):   at boolean com.google.android.gms.internal.zzka$zza.onTransact(int, android.os.Parcel, android.os.Parcel, int) ((null):-1)
04-25 12:27:41.448: I/zygote(24246):   at boolean android.os.Binder.transact(int, android.os.Parcel, android.os.Parcel, int) (Binder.java:622)
04-25 12:27:41.448: I/zygote(24246):   at android.os.Parcel ox.a(int, android.os.Parcel) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:2)
04-25 12:27:41.448: I/zygote(24246):   at com.google.android.gms.ads.internal.mediation.client.e com.google.android.gms.ads.internal.mediation.client.d.a(java.lang.String) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.448: I/zygote(24246):   at void com.google.android.gms.ads.internal.mediation.g.run() (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:6)
04-25 12:27:41.448: I/zygote(24246):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
04-25 12:27:41.448: I/zygote(24246):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
04-25 12:27:41.448: I/zygote(24246):   at void aai.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.448: I/zygote(24246):   at void com.google.android.gms.ads.internal.util.e.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.448: I/zygote(24246):   at void aai.dispatchMessage(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.448: I/zygote(24246):   at void android.os.Looper.loop() (Looper.java:164)
04-25 12:27:41.448: I/zygote(24246):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6798)
04-25 12:27:41.448: I/zygote(24246):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-25 12:27:41.448: I/zygote(24246):   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
04-25 12:27:41.448: I/zygote(24246):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
04-25 12:27:41.449: I/zygote(24246): Rejecting re-init on previously-failed class java.lang.Class<com.google.ads.mediation.facebook.FacebookAdapter>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/ads/mediation/facebook/FacebookMediationAdapter;
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.Class.classForName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:453)
04-25 12:27:41.449: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzau(java.lang.String) ((null):-1)
04-25 12:27:41.449: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzas(java.lang.String) ((null):-1)
04-25 12:27:41.449: I/zygote(24246):   at boolean com.google.android.gms.internal.zzka$zza.onTransact(int, android.os.Parcel, android.os.Parcel, int) ((null):-1)
04-25 12:27:41.449: I/zygote(24246):   at boolean android.os.Binder.transact(int, android.os.Parcel, android.os.Parcel, int) (Binder.java:622)
04-25 12:27:41.449: I/zygote(24246):   at android.os.Parcel ox.a(int, android.os.Parcel) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:2)
04-25 12:27:41.449: I/zygote(24246):   at com.google.android.gms.ads.internal.mediation.client.e com.google.android.gms.ads.internal.mediation.client.d.a(java.lang.String) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.449: I/zygote(24246):   at void com.google.android.gms.ads.internal.mediation.g.run() (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:6)
04-25 12:27:41.449: I/zygote(24246):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
04-25 12:27:41.449: I/zygote(24246):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
04-25 12:27:41.449: I/zygote(24246):   at void aai.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.449: I/zygote(24246):   at void com.google.android.gms.ads.internal.util.e.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.449: I/zygote(24246):   at void aai.dispatchMessage(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.449: I/zygote(24246):   at void android.os.Looper.loop() (Looper.java:164)
04-25 12:27:41.449: I/zygote(24246):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6798)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-25 12:27:41.449: I/zygote(24246):   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
04-25 12:27:41.449: I/zygote(24246):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
04-25 12:27:41.449: I/zygote(24246): Caused by: java.lang.ClassNotFoundException: com.google.ads.mediation.facebook.FacebookMediationAdapter
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.Class.classForName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:453)
04-25 12:27:41.449: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzau(java.lang.String) ((null):-1)
04-25 12:27:41.449: I/zygote(24246):   at com.google.android.gms.internal.zzkb com.google.android.gms.internal.zzjz.zzas(java.lang.String) ((null):-1)
04-25 12:27:41.449: I/zygote(24246):   at boolean com.google.android.gms.internal.zzka$zza.onTransact(int, android.os.Parcel, android.os.Parcel, int) ((null):-1)
04-25 12:27:41.449: I/zygote(24246):   at boolean android.os.Binder.transact(int, android.os.Parcel, android.os.Parcel, int) (Binder.java:622)
04-25 12:27:41.449: I/zygote(24246):   at android.os.Parcel ox.a(int, android.os.Parcel) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:2)
04-25 12:27:41.449: I/zygote(24246):   at com.google.android.gms.ads.internal.mediation.client.e com.google.android.gms.ads.internal.mediation.client.d.a(java.lang.String) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.449: I/zygote(24246):   at void com.google.android.gms.ads.internal.mediation.g.run() (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:6)
04-25 12:27:41.449: I/zygote(24246):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:789)
04-25 12:27:41.449: I/zygote(24246):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:98)
04-25 12:27:41.449: I/zygote(24246):   at void aai.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.449: I/zygote(24246):   at void com.google.android.gms.ads.internal.util.e.a(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
04-25 12:27:41.449: I/zygote(24246):   at void aai.dispatchMessage(android.os.Message) (:com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:-1)
04-25 12:27:41.449: I/zygote(24246):   at void android.os.Looper.loop() (Looper.java:164)
04-25 12:27:41.449: I/zygote(24246):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6798)
04-25 12:27:41.449: I/zygote(24246):   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-25 12:27:41.449: I/zygote(24246):   at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:240)
04-25 12:27:41.449: I/zygote(24246):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:767)
04-25 12:27:41.450: I/Ads(24246): Trying mediation network: https://googleads.g.doubleclick.net/aclk?sa=L&ai=Cl_QQbWHBXJCyJsLKxgK8iJa4D_nJ2qYF0e-FupIBABAIIPaf5WNgy9y0BakCAAAAAICELkGoAwGqBCpP0JYVqjXRsTejJKRPkKjp4qtE5jVAPiQVMm_0IRvtMMWUkrPG0sY8WVmQBgHABguAB4H4qTCYBwGoB9nLG6gHz8wb0ggHCIABEAEYDg&num=1&cid=CAASBORoPe4&sig=AOD64_2uPRs5nS_rhuIF-J_uAnHVfY4hYg&adurl=http://example.com
04-25 12:27:41.450: I/Ads(24246): Instantiating mediation adapter: com.google.ads.mediation.chartboost.ChartboostAdapter

As you can see that, when the call starts to instantiate for audience network adapter some zygote thing starts to throw these strange logs and the throws ClassNotFoundException that it did not found the google gms mediation adapter class. Further it ignores that and goes on further, then it shows another ClassNotFOundException for FacebookMediationAdapter. Strangely All these logs in LogCat are green not Red for Error and not Yellow for warning But Green Logs. But i ignored that and started to see why this was happening. i opened the audience network adapter aar file using JD-GUI and found the relevant FacebookMediationAdapter class there.

Then i opened play services and ads library aar file it also had the relevant gms Mediation class. More over the functions referenced in these classes were also present in these class.

Question than comes to my mind is why unity is not finding the classes when i can clearly see them. and second are these files even going with the package apk??


Solution

  • I have resolved this issue with a Mistake believe it or not, This was happening because of a strange thing, here it goes:

    The last time i did mediation it was of MoPub, and the steps in that were to import the mopub sdk, the relevant adnetwork SDK and the relevant mopub adapter file, In this case believe it or not, i only needed to import the Admob Unity SDK and Relevant AdNetwork Adapter, no Adnetwrok SDK was required at all to show the AD!!!

    Yes you heard me right, this was actually working, ad was showing without the relevant Unity SDK, i did this by mistake, i was working on another sdk and i forgot to import the SDK, the build succeeded and opened the file, loaded the ad and voila it showed. This was not mentioned in the guide it clearly stated to import all the SDK's.