Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics v4 in Android: Could not find class 'com.google.android.gms.analytics.Tracker'

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.

like image 649
Nicholas Avatar asked Jun 12 '26 08:06

Nicholas


1 Answers

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.

like image 166
chef Avatar answered Jun 13 '26 22:06

chef



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!