android - Google Play 服务中 UserRecoverableAuthException.getIntent() 中的 NullPointerException

标签 android android-intent google-play-services

我注意到 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作为IntentUserRecoverableAuthException构造函数...

因此解决方法是:

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/

相关文章:

android - Google Play 服务 6.5.87 与 7.3.0 - 布局问题?

java - Jsoup CSS 标签深入 html 页面

android - 更改或升级内置 org.json 库是否可能且是个好主意?

Java 逻辑 - while 循环中发生的奇怪事情

Android插入联系人不显示姓名

android - Android : INVALID_SCOPE 无法使用 Google+ 登录获取授权码

java - 如何从 Android 应用程序为 AWS Lambda 函数提供参数?

android - BroadcastReceivers 在监听 BOOT_COMPLETED 时接收到哪个上下文?

android - 关于Android中自定义权限的几个问题

android - 添加 play-services-maps 依赖自动添加 glEsVersion 2.0 要求