3

I am desperately trying to integrate GA v4 in my Android app. And I followed the guide here https://developers.google.com/analytics/devguides/collection/android/v4/

And integrated Google Play Services lib as described, but it gives me

Could not find class 'com.google.android.gms.analytics.Tracker

But I can find classes and its namespaces in the project.

I can't figure out what's happening here.

Gurfuffle
  • 784
  • 12
  • 32
Nicholas
  • 169
  • 1
  • 4
  • 15
  • did you include GooglePlay Services as lib to your project? – Deb Aug 18 '14 at 10:20
  • @Deb: Yes, I included them. – Nicholas Aug 18 '14 at 12:10
  • 1
    I had similar problem,then i updated my sdk,google play services,sdk-platform and sdk build tools.Then re-included the google play services again.That solved it for me.But i don't know if that is going to solve in your case. – Deb Aug 18 '14 at 12:18
  • @Deb What is your sdk version? – Nicholas Aug 18 '14 at 12:25
  • my sdk-tool version is 23.0.2 the latest one available in sdk manager – Deb Aug 18 '14 at 12:35
  • @Deb And Google play service is 19? Then it is same, I bet. :( – Nicholas Aug 18 '14 at 12:36
  • Unfortunately yes :( – Deb Aug 18 '14 at 12:47
  • Same problem, in a working project does not load Analytics lib project after the ADT update. :( Do you have any solution of the problem above? I also try a lot more answers and none of them works ( [link1](http://stackoverflow.com/questions/5167273/in-eclipse-unable-to-reference-an-android-library-project-in-another-android-pr), [link2](http://stackoverflow.com/questions/23595990/integrate-google-analytics-v4-into-an-android-app) ) – azendh Nov 28 '14 at 13:07

2 Answers2

2

I followed also the instruction on Analytics for Android v4.

But additionally I had to update play services and build tools in the SDK manager. Then I had to add compile 'com.google.android.gms:play-services:8.4.0' in the app build.gradle (above of compile 'com.google.android.gms:play-services-analytics:8.4.0'. The Tracker class was still unknown (red underlined) but despite of that I pressed "Run" (install app) in Android Studio and only then analytics was recognized and could be used.

chef
  • 75
  • 1
  • 12
-1

I had the same problem and the reason was my Google Play services package was outdated.

Using Eclipse, I went into Window > Android SDK Manager, checked only Google Play services package (under "Extras" in the bottom), updated it and created a new lib project.

Then I followed the steps in tutorial below to create a new google play services lib project.

https://developer.android.com/google/play-services/setup.html

Hope it helps!

/Paulo