我最近开始在Unity中从事Admob中介服务。使用《 Admob指南》,我已经成功完成了一些广告网络,但是现在偶然发现由于某些原因而无法正常工作的受众网络,我检查了以下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
如您所见,当针对受众网络适配器的调用开始实例化时,某些合子物开始引发这些奇怪的日志,并引发ClassNotFoundException,它未找到google gms中介适配器类。进一步,它忽略了这一点,并继续进行下去,然后显示了FacebookMediationAdapter的另一个ClassNotFOundException。奇怪的是,LogCat中的所有这些日志都是绿色,不是红色表示错误,不是黄色表示警告,而是绿色日志。但是我忽略了这一点,开始明白为什么会这样。我使用JD-GUI打开了受众网络适配器aar文件,并在那里找到了相关的FacebookMediationAdapter类。
然后,我打开了播放服务和广告库aar文件,它还具有相关的gms中介类。这些类中还提供了这些类中引用的更多功能。
我想到的一个问题就是为什么当我清楚地看到他们时,团结却找不到他们。其次是这些文件甚至与apk软件包一起使用吗?
答案 0 :(得分:0)
我已经解决了这个问题,信不信由你,这是由于一件奇怪的事情而发生的,它来了:
我上次进行调解的时间是MoPub,其中的步骤是导入mopub sdk,相关的adnetwork SDK和相关的mopub适配器文件,在这种情况下,不管您相信与否,我只需要导入Admob Unity SDK和相关的AdNetwork适配器,完全不需要Adnetwrok SDK即可显示广告!
是的,您没听错,这确实有效,广告在没有相关Unity SDK的情况下显示,我是错误地做到了,我在另一个SDK上工作,却忘记了导入SDK,构建成功并打开了文件,加载了广告并显示了该广告。指南中没有明确指出要导入所有SDK的内容。