I have a problem implementing Google Analytics in the LibGDX game app. I want to track game screens, but Google Analytics only works in the Android directory part of the Gradle project. In the main part, it does not get context for game screen classes, although I added libGoogleAnalyticsServices.jar to the main folder. I searched for solutions over the Internet, but nothing worked, so I can’t initialize Google Analytics in the main part of the project.
This is the code snippet where I am trying to initialize Google Analytics:
GoogleAnalytics GA = GoogleAnalytics.getInstance();
and this gives me this error "The type android.content.Context cannot be resolved. It indirectly refers to the required .class files"
Should I use libGoogleAnalyticsServices.jar of an Android project in Core or use a different jar file for this task?
Below are some links where I found information on this issue.
Google Event Tracker v3
https://developers.google.com/analytics/devguides/collection/android/v3/migration
http://badlogicgames.com/forum/viewtopic.php?f=11&t=4298
Any answer to this particular question would be very helpful. Thank you in advance.
source
share