我注意到 Google Play 服务库中出现了奇怪的异常:
at java.lang.Thread.run(Thread.java:856)Caused by: java.lang.NullPointerException
at android.content.Intent.(Intent.java:3503)
at com.google.android.gms.auth.UserRecoverableAuthException.android.content.Intent getIntent()(Unknown Source)
最佳答案
检查后google-play-services.jar
我发现他们通过了 null
作为Intent
在 UserRecoverableAuthException
构造函数...
因此解决方法是:
catch (UserRecoverableAuthException userRecoverableAuthException) {
Intent intent = userRecoverableAuthException.getIntent();
if (intent != null) {
mActivity.startActivityForResult(intent, GOOGLE_PLAY_SERVICES_AUTH_REQUEST_CODE);
}
编辑:
在使用 java 反编译器后我找到了一个原因:
throw new UserRecoverableAuthException("AppDownloadRequired", null);
被扔进GoogleAuthUtil
上课时 bindService
返回 false。
解决方案是抛出另一种类型的异常或为此类情况提供有效的 Intent 。
很遗憾 Google 没有为 Google Play 服务提供问题跟踪器...
更新:
检查源的新修订版 (r13) 似乎问题已解决。
关于android - Google Play 服务中 UserRecoverableAuthException.getIntent() 中的 NullPointerException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17545118/