我正在使用ACRA(arca.ch)生成自動錯誤報告。GooglePlayServicesUtil.getErrorDialog爲空
我剛剛使用Google Maps Android API v2發佈了我的應用程序的新版本。當試圖顯示GooglePlayServicesUtil.getErrorDialog返回的對話框時,我收到EEEPad和Transformer Pad用戶報告的錯誤。有誰知道爲什麼會發生這種情況?
下面是相關的代碼和logcat中所報告的ACRA:
在呼籲這行:
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的爲谷歌錯誤報告鏈接的答案)我會更新這個問題。如果您遇到這個問題,不希望您的應用程序崩潰的平均時間,這裏是我在做什麼暫且:
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線程上運行? –