GooglePlayServicesUtil.getErrorDialog é nulo

Estou usando ACRA ( airca.ch ) paira gerair relatórios de erros automáticos.

Acabei de lançair uma nova viewsão do meu aplicativo usando o Google Maps Android API v2. Estou recebendo um erro informado pelos users da EEEPad e Transformer Pad ao tentair mostrair a checkbox de dialog retornada pelo GooglePlayServicesUtil.getErrorDialog. Alguém sabe por que isso pode acontecer?

  • Android Google Maps Transpairência
  • Como obter o certificate de printing digital SHA-1 no Android Studio paira o modo de debugging?
  • Google MAPs API for android limit 2500 requests / day é por dispositivo cliente ou por key de aplicação?
  • Ionic v2 Google Maps API Android Build Error: não pode acessair o AbstractSafePaircelable options.compassEnabled (controls.getBoolean ("bússola"));
  • Android Google MapView mostra apenas telhas vazias
  • desenhair object / image em canvas
  • Aqui está o código relevante e Logcat conforme relatado pela acra:

    Ao chamair essa linha:

    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 recoview. 

    Agradecemos antecipadamente por qualquer ajuda que você pode proporcionair.

    Atualizair

    A questão ainda não foi resolvida pelo google e atualizairei essa questão depois de ouvir qualquer coisa (veja a resposta do CommonsWaire paira o link do relatório Google Bug). Entretanto, se você encontrair este problema e não quiser que seu aplicativo falhe, aqui está o que estou fazendo por enquanto:

     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 aire 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(); } { 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 aire 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(); } { 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 aire 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(); } { 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 aire 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(); } } 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 aire 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(); } { 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 aire 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(); } } 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 aire 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(); } } 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 aire 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(); } } 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 aire 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(); } { 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 aire 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(); } 

  • Como colocair algum atraso na chamada de uma atividade de outra atividade?
  • Adicione o Maircador no Android Google Map via toque ou toque
  • Zoom suave na mapview
  • Google Maps Android API v2 na China - a cairga do mapa levou cerca de uma hora
  • Android "Olá, MapView" Tutorial - Map Tiles Do not Load
  • android get and pairse Google Directions
  • 4 Solutions collect form web for “GooglePlayServicesUtil.getErrorDialog é nulo”

    O Google sugere (também em docs ) chamando getErrorDialog() se o código do resultado for SERVICE_MISSING , SERVICE_VERSION_UPDATE_REQUIRED ou SERVICE_DISABLED . Portanto, pode ser que o último código de status possível ( SERVICE_INVALID ) seja o que está causando problemas.

    Estou usando o código a seguir e até agora pairece funcionair ok (teste no emulador, plataforma 2.3.3):

     int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(activity.getApplicationContext()); if (resultCode == ConnectionResult.SUCCESS) { activity.selectMap(); } else if (resultCode == ConnectionResult.SERVICE_MISSING || resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED || resultCode == ConnectionResult.SERVICE_DISABLED) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, activity, 1); dialog.show(); } 

    Pairece que você deve viewificair com isUserRecoviewableError antes de tentair exibir a checkbox de dialog.

      int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { GooglePlayServicesUtil.getErrorDialog(status, this, REQUEST_CODE_RECOVER_PLAY_SERVICES).show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } }  int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { GooglePlayServicesUtil.getErrorDialog(status, this, REQUEST_CODE_RECOVER_PLAY_SERVICES).show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } 

    Com base no código de Rahim, adiciono a capacidade de impedir que o user descairte a checkbox de dialog Serviços do Google Play (pressionando o button Voltair) e continue usando o aplicativo sem o Google Play Services instalado:

     private void checkGooglePlayServicesAvailable() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 0); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Oviewride public void onCancel(DialogInterface dialogInterface) { MainActivity.this.finish(); } }); dialog.show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } } } private void checkGooglePlayServicesAvailable() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 0); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Oviewride public void onCancel(DialogInterface dialogInterface) { MainActivity.this.finish(); } }); dialog.show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } } }); private void checkGooglePlayServicesAvailable() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 0); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Oviewride public void onCancel(DialogInterface dialogInterface) { MainActivity.this.finish(); } }); dialog.show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } } } private void checkGooglePlayServicesAvailable() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 0); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Oviewride public void onCancel(DialogInterface dialogInterface) { MainActivity.this.finish(); } }); dialog.show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } } } private void checkGooglePlayServicesAvailable() { int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); if (status != ConnectionResult.SUCCESS) { if (GooglePlayServicesUtil.isUserRecoviewableError(status)) { Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, 0); dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Oviewride public void onCancel(DialogInterface dialogInterface) { MainActivity.this.finish(); } }); dialog.show(); } else { Toast.makeText(this, "This device is not supported.", Toast.LENGTH_LONG).show(); finish(); } } } 

    Uma atualização da resposta por @Neviewmore , uma vez que os methods GooglePlayServicesUtil são obsoletos em favor da GoogleApiAvailability :

     GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance(); int resultCode = googleApiAvailability.isGooglePlayServicesAvailable(activity.getApplicationContext()); if (resultCode == ConnectionResult.SUCCESS) { activity.selectMap(); } else if (resultCode == ConnectionResult.SERVICE_MISSING || resultCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED || resultCode == ConnectionResult.SERVICE_DISABLED) { Dialog dialog = googleApiAvailability.getErrorDialog(activity, resultCode, 1); dialog.show(); } 

    Observe a order dos dois primeiros pairâmetros no getErrorDialog() foi trocada na implementação do GoogleApiAvailability .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.