尝试解决像这样的google-play-services错误时:
GooglePlayServicesUtil.showErrorDialogFragment(connectionResult.getErrorCode(), base, 100, new DialogInterface.OnCancelListener() {
@Override
public void onCancel(final DialogInterface dialogInterface) { }
});
作为没有玩游戏的模拟器上的测试用例 - 我得到以下异常并且还没有找到解决方法
D/gobandroid( 3370): java.lang.NullPointerException
D/gobandroid( 3370): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1410)
D/gobandroid( 3370): at android.app.Activity.startActivityForResult(Activity.java:3370)
D/gobandroid( 3370): at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48)
D/gobandroid( 3370): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:75)
D/gobandroid( 3370): at android.app.Activity.startActivityForResult(Activity.java:3331)
D/gobandroid( 3370): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:871)
D/gobandroid( 3370): at com.google.android.gms.common.internal.zzi$1.zzasn(Unknown Source)
D/gobandroid( 3370): at com.google.android.gms.common.internal.zzi.onClick(Unknown Source)
D/gobandroid( 3370): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:166)
D/gobandroid( 3370): at android.os.Handler.dispatchMessage(Handler.java:99)
D/gobandroid( 3370): at android.os.Looper.loop(Looper.java:137)
D/gobandroid( 3370): at android.app.ActivityThread.main(ActivityThread.java:5041)
D/gobandroid( 3370): at java.lang.reflect.Method.invokeNative(Native Method)
D/gobandroid( 3370): at java.lang.reflect.Method.invoke(Method.java:511)
D/gobandroid( 3370): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
D/gobandroid( 3370): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
D/gobandroid( 3370): at dalvik.system.NativeStart.main(Native Method)
此次通话也发生了同样的事情:
GooglePlayServicesUtil.showErrorDialogFragment(connectionResult.getErrorCode(), base, null, 100, null);
显示对话框,但按OK后我得到了NPE