Audience Network 无法与 Admob 中介合作

Audience Network not working with Admob Mediation

我最近开始在 Unity 中使用 Admob Mediation。使用 Admob 指南,我已经成功地完成了一些广告网络,但现在偶然发现 Audience Network 由于某种原因无法正常工作,我检查了以下 Logcat:

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

如您所见,当调用开始为受众网络适配器实例化时,一些 zygote 东西开始抛出这些奇怪的日志,并抛出 ClassNotFoundException,它没有找到 google gms 中介适配器 class。此外,它忽略了这一点并继续进行下去,然后它为 FacebookMediationAdapter 显示了另一个 ClassNotFOundException。奇怪的是 LogCat 中的所有这些日志都是绿色的,不是红色表示错误,也不是黄色表示警告而是绿色日志。但我忽略了这一点,并开始明白为什么会这样。我使用 JD-GUI 打开了观众网络适配器 aar 文件,并在那里找到了相关的 FacebookMediationAdapter class。

然后我打开播放服务和广告库 aar 文件它也有相关的 gms 调解 class。这些 classes 中引用的更多功能也出现在这些 class 中。

我想到的问题是为什么当我可以清楚地看到 classes 时 unity 找不到它们。其次,这些文件是否与 apk 包一起使用??

我已经解决了这个问题,不管你信不信,这是因为一件奇怪的事情而发生的,这里是:

我上次做的中介是MoPub,里面的步骤是导入mopub sdk,相关的adnetwork SDK和相关的mopub adapter文件,信不信由你,我只需要导入 Admob Unity SDK 和相关 AdNetwork Adapter,根本不需要 Adnetwrok SDK 来显示广告!!!

是的,你没听错,这确实有效,广告在没有相关 Unity SDK 的情况下展示,我做错了,我正在开发另一个 sdk,但我忘记导入 SDK,构建成功并打开文件,加载广告,瞧,它显示了。指南中没有提到它明确指出要导入所有 SDK。