nicktook
nicktook

Reputation: 154

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?

Upvotes: 4

Views: 10962

Answers (1)

Iulia Barbu
Iulia Barbu

Reputation: 1530

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)

Upvotes: 8

Related Questions