Używam ACRA (arca.ch) do generowania raportów o błędach.GooglePlayServicesUtil.getErrorDialog ma wartość null
Właśnie wydałem nową wersję mojej aplikacji za pomocą Google Maps Android API v2. Dostaję błąd zgłoszony przez użytkowników EEEPad i Transformer Pad podczas próby wyświetlenia okna zwróconego przez GooglePlayServicesUtil.getErrorDialog. Czy ktoś wie, dlaczego tak się stało?
Oto odpowiedni kod i Logcat jak donosi Acra:
Podczas rozmowy tej linii:
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.
Dzięki z góry za wszelką pomoc można dostarczyć .
Aktualizacja
Problem nie został rozwiązany przez google i jeszcze będę aktualizować tę kwestię raz słyszę coś (patrz odpowiedź CommonsWare za Bug linku raport Google). W tym czasie, jeśli natkniesz się tego problemu i nie chcą swoją aplikację do katastrofy, oto co robię na razie:
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();
}
Witaj, DiscDev, Kiedy próbuję użyć showOkDialogWithText(), pojawia się błąd mówiący, że "nie można utworzyć programu obsługi wewnątrz wątku, który nie nazwał looper.prepare()", dlaczego próbuje uruchomić wątek roboczy zamiast wątku interfejsu użytkownika? –