I use Google Analytics in my Android App and it works well. After updating the SDK (google play service) to the current version (6587000) the app hangs up at startup at foll
I had the same ANR issue every time I was calling GoogleAnalytics.getInstance(this). The problem seems to appear when the Google Play Services version in the app is not matching the one installed on the device.
I solved this by checking if Google Play Services is "available":
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
// Create your tracker...
}
This is a know bug in Google Play Services 6.5.
The issue is fixed in Google Play Services 7.0 that was released in March 19, 2015. Upgrading to 7.0 fixes the deadlock. https://developer.android.com/google/play-services/index.html
i had similar i removed the below code and application runs..
<meta-data
android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics_global_config" />
and add following code for getTracker class... build the GoogleAnalytics using java code rather than XML approch
synchronized Tracker getTracker(TrackerName trackerId) {
Log.d(TAG, "getTracker()");
if (!mTrackers.containsKey(trackerId)) {
GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
// Global GA Settings
// <!-- Google Analytics SDK V4 BUG20141213 Using a GA global xml freezes the app! Do config by coding. -->
analytics.setDryRun(false);
analytics.getLogger().setLogLevel(Logger.LogLevel.INFO);
//analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
// Create a new tracker
Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.ga_tracker_config) : null;
if (t != null) {
t.enableAdvertisingIdCollection(true);
}
mTrackers.put(trackerId, t);
}
return mTrackers.get(trackerId);
}