Tôi đang sử dụng ACRA (arca.ch) để tạo báo cáo lỗi tự động.GooglePlayServicesUtil.getErrorDialog is null
Tôi vừa phát hành phiên bản mới của ứng dụng của mình bằng API Android của Google Maps phiên bản v2. Tôi nhận được thông báo lỗi do người dùng EEEPad và Transformer Pad báo cáo khi cố gắng hiển thị hộp thoại được trả về bởi GooglePlayServicesUtil.getErrorDialog. Có ai biết tại sao điều này có thể xảy ra?
Đây là mã có liên quan và Logcat theo báo cáo của Acra:
Trong khi gọi dòng này:
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.
Cảm ơn trước sự giúp đỡ nào bạn có thể cung cấp .
Cập nhật
Vấn đề chưa được giải quyết bằng google chưa và tôi sẽ cập nhật câu hỏi này một lần tôi nghe thấy bất cứ điều gì (xem câu trả lời CommonsWare cho các liên kết báo cáo lỗi của Google). Trong lúc này nếu bạn gặp vấn đề này và không muốn ứng dụng của bạn sụp đổ, đây là những gì tôi đang làm cho thời gian được:
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();
}
Hi DiscDev, Khi tôi cố gắng sử dụng showOkDialogWithText() nó là lỗi khi nói rằng "không thể tạo bộ xử lý bên trong luồng mà không được gọi là looper.prepare()" tại sao nó cố gắng chạy trên chuỗi công nhân thay vì chuỗi giao diện người dùng? –