【发布时间】:2017-05-12 04:45:06
【问题描述】:
我们遇到了 Google Place Picker 的问题,它无法在一部特定手机(运行 Android 6.0 的 MI Note 4)上启动,并引发异常对话框“不幸的是,Google Play 服务...”。
1) 代码正在我们拥有的所有测试手机上运行,除了这款手机,大约有 20 种不同的型号,从姜饼到牛轧糖。因此,权限和密钥似乎没有问题。 com.google.android.geo.API_KEY 正确放置在应用程序部分。
2) 这个问题尤其发生在这款手机上。 Google play 服务已安装在手机上,调用 GooglePlayServicesUtil.isGooglePlayServicesAvailable 会按预期返回 ConnectionResult.SUCCESS,我们会在启动地点选择器之前对其进行检查。
3) 另外,手机有游戏商店,谷歌地图运行良好,这进一步确认游戏服务正常。
4) 我们甚至尝试将 google play API 降级到 10.0.1 和 9.2.0 只是为了找到原因,但行为是相同的。
下面是代码,它是标准的地点选择器代码。
try {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Intent intent = builder.build(this);
startActivityForResult(intent, PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
GooglePlayServicesUtil
.getErrorDialog(e.getConnectionStatusCode(), this, 0);
} catch (GooglePlayServicesNotAvailableException e) {
Toast.makeText(this, "Google Play Services is not available.", Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(this, "Google Play Services exception.", Toast.LENGTH_LONG).show();
}
知道可能出了什么问题吗?
【问题讨论】:
-
logcat 中是否有任何异常记录可以发布?