How to use libGoogleAnalyticsV2.jar with Android Studio

android, android-studio, google-analytics

Solution

You need to reference the jar in the build.gradle, something like this:

dependencies {
    ....
    compile files('libs/libGoogleAnalyticsV2.jar')

`libs` in this case being the libs dir in your project, above `src`

Problem

I'm trying to get the libGoogleAnalyticsV2.jar imported to my project in Android Studio. First I added it using the Project Structure which corrected any red lines when trying to use EasyTracker. But when I compiled it resulted with errors and the build failed. ``` Gradle: package com.google.analytics.tracking.android does not exist Gradle: cannot find symbol variable EasyTracker Gradle: cannot find symbol variable EasyTracker ``` I'm using the lib like this: ``` EasyTracker.getInstance().activityStart(this); ``` What can I do to make this work? Thanks

Original source