我使用unity,在不使用AdMob的情况下使用google play游戏服务(最新版本0.9.64)在我的游戏中效果很好,但是当我从Google Play商店下载游戏并添加AdMob(最新版本3.18.0)时,单击打开按钮,那里显示此错误“应用程序名称已停止”,但游戏仍在后台运行,我可以正常播放,并且可以从手机小部件中打开它而没有该错误,但是如果我单击一个按钮,则会再次出现此错误我的游戏可以登录Google Play服务,广告效果很好
如果这是唯一可行的方法,我可能会使用最旧的gpgs版本,但是从商店中打开游戏后,我仍然得到错误消息“ app name has stop”的解决方案吗?
使用gpgs和admob最新版本的Logcat,下载后我直接从google play商店打开了游戏,并且出现了“应用名称已停止”错误:
07-09 20:32:20.903: E/Unity(2689): AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.MobileAds
07-09 20:32:20.903: E/Unity(2689): java.lang.ClassNotFoundException: com.google.android.gms.ads.MobileAds
07-09 20:32:20.903: E/Unity(2689): at java.lang.Class.classForName(Native Method)
07-09 20:32:20.903: E/Unity(2689): at java.lang.Class.forName(Class.java:308)
07-09 20:32:20.903: E/Unity(2689): at java.lang.Class.forName(Class.java:272)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer.c(Unknown Source)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
07-09 20:32:20.903: E/Unity(2689): at android.os.MessageQueue.next(MessageQueue.java:211)
07-09 20:32:20.903: E/Unity(2689): at android.os.Looper.loop(Looper.java:122)
07-09 20:32:20.903: E/Unity(2689): at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
07-09 20:32:20.903: E/Unity(2689): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.MobileAds" on path: DexPathList[[zip file "/data/app/com.Kadev.HungryyBears-1/base.apk"],nativeLibraryDirectories=[/data/app/com.Kadev.HungryyBears-1/lib/arm, /vendor/lib, /system/lib]]
07-09 20:32:20.903: E/Unity(2689): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-09 20:32:20.903: E/Unity(2689): at java.lang.ClassLoader.loadCla
使用gpgs和admob最新版本时,我单击Logcat进入gpgs按钮,然后出现相同错误:
07-09 20:10:12.633: W/Unity(31914): OnLevelWasLoaded was found on Reporter
07-09 20:10:12.633: W/Unity(31914): This message has been deprecated and will be removed in a later version of Unity.
07-09 20:10:12.633: W/Unity(31914): Add a delegate to SceneManager.sceneLoaded instead to get notifications after scene loading has completed
07-09 20:10:12.633: W/Unity(31914):
07-09 20:10:12.633: W/Unity(31914): (Filename: Line: 356)
07-09 20:10:18.273: I/Unity(31914): Ads Request Created
07-09 20:10:18.273: I/Unity(31914):
07-09 20:10:18.273: I/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
07-09 20:10:25.003: I/Unity(31914): HandleAdLoaded event received
07-09 20:10:25.003: I/Unity(31914):
07-09 20:10:25.003: I/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
07-09 20:10:32.073: I/Unity(31914): Starting Auth with token client.
07-09 20:10:32.073: I/Unity(31914):
07-09 20:10:32.073: I/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
07-09 20:10:32.103: W/Unity(31914): !!! [Play Games Plugin DLL] 07/09/19 19:10:32 +00:00 WARNING: Creating new PlayGamesPlatform
07-09 20:10:32.103: W/Unity(31914):
07-09 20:10:32.103: W/Unity(31914): (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
答案 0 :(得分:0)
-您可以按照以下说明解决此问题。转到
资产->播放服务解析器-> Android->强制解析
-如果以上说明不起作用,则必须遵循以下说明,
玩家设置->发布设置->将minify选项中的发行和调试设置为“无”。
类似的问题: https://answers.unity.com/questions/1464677/admob-plugin-error-javalangclassnotfoundexception.html
答案 1 :(得分:0)
GPGS 0.9.64和AdMob 0.18.0的解决方案是在播放器设置中检查proguard选项,这将在plugins / android文件夹中创建一个空的proguard文件,并在Visual Studio中打开该文件,然后跳过该代码(由Github中的SlobodanNikolic建议)网站https://github.com/googleads/googleads-mobile-unity/issues/598):
-dontwarn com.google.vr.ndk.base.DaydreamApi
-keep class com.facebook.** {
*;
}
-keep class com.google.unity.** {
*;
}
-keep public class com.google.android.gms.ads.**{
public *;
}
-keep public class com.google.ads.**{
public *;
}
-keepattributes *Annotation*
-dontobfuscate
使用上述解决方案时,您仍然会第一次从Google Play崩溃消息中打开游戏。 但是几天后,他们发布了新版本的AdMob 0.18.1,可以与GPGS 0.9.64很好地兼容,而不会出现此问题。