【发布时间】:2012-12-05 15:07:05
【问题描述】:
我正在使用 ACRA (arca.ch) 生成自动错误报告。
我刚刚使用 Google Maps Android API v2 发布了我的应用程序的新版本。我在尝试显示 GooglePlayServicesUtil.getErrorDialog 返回的对话框时收到 EEEPad 和 Transformer Pad 用户报告的错误。有谁知道为什么会发生这种情况?
这是acra报告的相关代码和Logcat:
调用此行时:
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if(resultCode != ConnectionResult.SUCCESS)
{
//The dialog that comes back is null (probably due to the logcat message)
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 69);
//So when I call the next line, the app crashes with a NullPointerException
dialog.show();
}
...
Logcat:
12-18 04:21:04.531 W/GooglePlayServicesUtil( 3977): Google Play Store signature invalid.
12-18 04:21:04.551 E/GooglePlayServicesUtil( 3977): Google Play services is invalid. Cannot recover.
提前感谢您提供的任何帮助。
更新
谷歌尚未解决该问题,我将在听到任何消息后更新此问题(请参阅 CommonsWare 对 Google 错误报告链接的回答)。同时,如果您遇到此问题并且不希望您的应用崩溃,我目前正在做的是:
public void checkGooglePlayServicesAvailability()
{
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if(resultCode != ConnectionResult.SUCCESS)
{
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 69);
if(dialog != null)
{
dialog.show();
}
else
{
showOkDialogWithText(this, "Something went wrong. Please make sure that you have the Play Store installed and that you are connected to the internet. Contact developer with details if this persists.");
}
}
Log.d("GooglePlayServicesUtil Check", "Result is: " + resultCode);
}
public static void showOkDialogWithText(Context context, String messageText)
{
Builder builder = new AlertDialog.Builder(context);
builder.setMessage(messageText);
builder.setCancelable(true);
builder.setPositiveButton("OK", null);
AlertDialog dialog = builder.create();
dialog.show();
}
【问题讨论】:
-
嗨 DiscDev,当我尝试使用 showOkDialogWithText() 时会抛出错误,提示“无法在未调用 looper.prepare() 的线程内创建处理程序”为什么它试图在工作线程上运行而不是 UI 线程?
标签: android google-maps google-maps-android-api-2 google-play-services