Android Google Analytics que causa la pantalla negra

Acabo de seguir este tutorial para agregar Google Analytics SDK v4 en una aplicación para Android. El problema ahora es que cuando ejecuto la aplicación sólo da una pantalla en negro en cualquier vista que he configurado con el seguimiento. Por ejemplo, debajo de los métodos onCreate, onStart y onStop de la primera vista después de la pantalla de bienvenida. La pantalla de bienvenida se carga muy bien, entonces acabo de obtener una pantalla en negro en la vista. Si comentaste el código analítico todo funciona

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.landing_screen); //Get a Tracker (should auto-report) //Define font for use Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/cabinregular.otf"); //Set font to all elements ((TextView) findViewById(R.id.textFlat)).setTypeface(typeface); ((TextView) findViewById(R.id.textCool)).setTypeface(typeface); ((TextView) findViewById(R.id.textWarm)).setTypeface(typeface); ((TextView) findViewById(R.id.textPastels)).setTypeface(typeface); ((TextView) findViewById(R.id.textDecades)).setTypeface(typeface); ((TextView) findViewById(R.id.textNeutrals)).setTypeface(typeface); ((TextView) findViewById(R.id.textMidTones)).setTypeface(typeface); //((TextView) findViewById(R.id.appHeaderText)).setTypeface(typeface); //Create all the listeners to catch button presses ImageButton buttonFlat = (ImageButton) findViewById(R.id.buttonFlat); buttonFlat.setOnClickListener(this); ImageButton buttonCool = (ImageButton) findViewById(R.id.buttonCool); buttonCool.setOnClickListener(this); ImageButton buttonWarm = (ImageButton) findViewById(R.id.buttonWarm); buttonWarm.setOnClickListener(this); ImageButton buttonPastels = (ImageButton) findViewById(R.id.buttonPastels); buttonPastels.setOnClickListener(this); ImageButton buttonDecades = (ImageButton) findViewById(R.id.buttonDecades); buttonDecades.setOnClickListener(this); ImageButton buttonNeutrals = (ImageButton) findViewById(R.id.buttonNeutrals); buttonNeutrals.setOnClickListener(this); ImageButton buttonMidTones = (ImageButton) findViewById(R.id.buttonMidTones); buttonMidTones.setOnClickListener(this); ((colorlibApplicationClass) getApplication()).getTracker(colorlibApplicationClass.TrackerName.APP_TRACKER); } public void onStart() { super.onStart(); //Get an Analytics tracker to report app starts & uncaught exceptions etc. GoogleAnalytics.getInstance(this).reportActivityStart(this); } public void onStop() { super.onStop(); //Stop the analytics tracking GoogleAnalytics.getInstance(this).reportActivityStop(this); } 

Aquí está la clase de aplicación;

 package com.exampleapp.colorlib; import android.app.Application; import com.google.android.gms.analytics.GoogleAnalytics; import com.google.android.gms.analytics.Tracker; import java.util.HashMap; public class colorlibApplicationClass extends Application { // The following line should be changed to include the correct property id. private static final String PROPERTY_ID = "UA-REMOVED-FOR-SECURITY"; //Logging TAG private static final String TAG = "MyApp"; public static int GENERAL_TRACKER = 0; public enum TrackerName { APP_TRACKER, // Tracker used only in this app. GLOBAL_TRACKER, // Tracker used by all the apps from a company. eg: roll-up tracking. ECOMMERCE_TRACKER,// Tracker used by all the apps from a company. eg: roll-up tracking. } HashMap<TrackerName, Tracker> mTrackers = new HashMap<TrackerName, Tracker>(); public colorlibApplicationClass() { super(); } synchronized Tracker getTracker(TrackerName trackerId) { if (!mTrackers.containsKey(trackerId)) { GoogleAnalytics analytics = GoogleAnalytics.getInstance(this); Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.app_tracker) : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(PROPERTY_ID) : analytics.newTracker(R.xml.ecommerce_tracker); mTrackers.put(trackerId, t); } return mTrackers.get(trackerId); } } 

Es un problema de la última versión. Compruebe aquí para más información.

Mientras tanto, tal vez sea mejor usar una versión anterior. Este funciona bien:

Compile 'com.google.android.gms: play-services: 6.1. +'

Editar: Eliminar los meta-datos de configuración global de AndroidManifest funcionó bien.

  • Diferencias entre Android e iOS al usar Google Analytics en PhoneGap 1.2.0
  • Error al obtener el ID del anunciante
  • Exportar informe con la Consola del programador - "Guardar los visitantes de la lista"
  • Seguimiento de instalaciones de web a dispositivo mediante Google Analytics v4
  • "AnalyticsReceiver no está registrado o está deshabilitado."
  • Google Analytics para Android: establece información sobre dispositivo móvil
  • Uso de Google Analytics para rastrear fragmentos
  • Envío de la carga útil de los pares clave-valor a Google Analytics
  • Ver el valor de evento de Google Analytics
  • ¿Sólo un BroadcastReceiver por aplicación?
  • ANR Ejecutando el servicio com.example.app/com.google.android.gms.analytics.AnalyticsService
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.