Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding google analytics to an android app

I have a working android app and now want to add google analytics to it. I am following the instructions here:

http://code.google.com/mobile/analytics/docs/android/

When I add the import statement:

import com.google.android.apps.analytics.GoogleAnalyticsTracker;

I get the error:

The import com.google.android cannot be resolved

I have created a libs directory in the project and placed the libGoogleAnalytics.jar file in it. I tried adding this to the AndroidManifest.xml:

<uses-library android:name="com.google.android.analytics" />

I have tried opening and closing Eclipse and doing 'Project / Clean'. Nothing seems to affect the problem. I am somewhat new to Java. What am I missing?

like image 239
nicktook Avatar asked Feb 22 '23 14:02

nicktook


1 Answers

I think you should add library libGoogleAnalytics.jar to build path (in libs right click on libGoogleAnalytics.jar -> BuildPAth -> Add to Build Path) Do not add anything in Manifest file and in your java file use cmd+Shift+O(for Mac, for Windows Ctrl+Shift+O) to automatically organize your imports)

like image 94
Iulia Barbu Avatar answered Mar 06 '23 05:03

Iulia Barbu