我正在尝试整合Google游戏中心,但我看到这个错误就是强制关闭应用。 这是错误
03-31 18:35:12.822: E/AndroidRuntime(12814): java.lang.NullPointerException
03-31 18:35:12.822: E/AndroidRuntime(12814):
at com.google.android.gms.common.ConnectionResult.startResolutionForResult(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at org.anddev.andengine.ui.activity.GameHelper.resolveConnectionResult(GameHelper.java:856)
03-31 18:35:12.822: E/AndroidRuntime(12814): at org.anddev.andengine.ui.activity.GameHelper.onConnectionFailed(GameHelper.java:832)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.internal.ei.a(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.common.api.b.dy(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.common.api.b.d(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.common.api.b$4.onConnectionFailed(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.internal.ei.a(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.internal.eh$h.b(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.internal.eh$h.a(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.internal.eh$b.ec(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.google.android.gms.internal.eh$a.handleMessage(Unknown Source)
03-31 18:35:12.822: E/AndroidRuntime(12814): at android.os.Handler.dispatchMessage(Handler.java:102)
03-31 18:35:12.822: E/AndroidRuntime(12814): at android.os.Looper.loop(Looper.java:136)
03-31 18:35:12.822: E/AndroidRuntime(12814): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-31 18:35:12.822: E/AndroidRuntime(12814): at java.lang.reflect.Method.invokeNative(Native Method)
03-31 18:35:12.822: E/AndroidRuntime(12814): at java.lang.reflect.Method.invoke(Method.java:515)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-31 18:35:12.822: E/AndroidRuntime(12814): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-31 18:35:12.822: E/AndroidRuntime(12814): at dalvik.system.NativeStart.main(Native Method)
请帮我解决这个问题我很困难。 感谢
答案 0 :(得分:8)
此问题在mActivity == null
时生成。关于类似问题有a post,基本上说该函数是在活动的onStop()
方法之后调用的,该方法会使mActivity
无效。
此问题可能很快就会得到解决,因此您应该跟踪BaseGameUtils更新。截至2014年4月8日的BaseGameUtils& Google Play Services v16(4.3),此问题很有用。
以下修补程序修复了此问题 - GameHelper.java, line 849
,替换:
if (mConnectionResult.hasResolution()) {
使用:
if ((mConnectionResult.hasResolution())&&(mActivity != null)) {