Android Google Play Services中UserRecoverableAuthException.getIntent()中的NullPointerException
我注意到Google Play Services库中有一个奇怪的异常:Android Google Play Services中UserRecoverableAuthException.getIntent()中的NullPointerException,android,android-intent,google-play-services,Android,Android Intent,Google Play Services,我注意到Google Play Services库中有一个奇怪的异常: 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 getI
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)
检查
googleplayservices.jar
后,我发现它们在UserRecoverableAuthException
构造函数中传递null
作为Intent
因此,解决办法是:
catch (UserRecoverableAuthException userRecoverableAuthException) {
Intent intent = userRecoverableAuthException.getIntent();
if (intent != null) {
mActivity.startActivityForResult(intent, GOOGLE_PLAY_SERVICES_AUTH_REQUEST_CODE);
}
编辑:
在使用java反编译器之后,我发现了一个原因:
抛出新的UserRecoverableAuthException(“AppDownloadRequired”,null)代码>
当bindService
返回false时,在GoogleAuthUtil
类中抛出
解决这个问题的方法是抛出另一种类型的异常,或者为这种情况提供有效的意图
很遗憾,谷歌没有为谷歌Play服务提供问题追踪器
更新:
检查源代码的新版本(r13)似乎问题已经解决。我也有同样的问题
方法userRecoverableAuthException.getIntent()
与驱动器相关,
因此,我认为你需要检查驾驶课程,这是非常必要的
例如:公共静态驱动器mDriveService代码>
(这是mDriveService)您使用google-play-services.jar吗?如果是:哪个版本?最新版本7。你能告诉我你用的是什么范围吗?另外,deviceInfo和实际代码将帮助我们跟踪问题。嗯,检查getIntent()是否返回null没有帮助,因为问题不在于它返回null,而是它抛出了NullPointerException。getIntent()方法是引发异常的方法。请参阅OP回溯的第三行和解决方法的第二行。