Rojoxpress
Rojoxpress

Reputation: 21

NoClassDefFoundError: com.google.android.gms.analytics.Tracker

I'm trying to use the new RecyclerView but when I put it on my project it give me this error in JellyBean 4.1.2

E/dalvikvm﹕ Could not find class 'com.google.android.gms.analytics.Tracker', referenced from method com.redtab.android.MyApplication.getTracker

and when I take out the RecyclerView it does work.

here is my gradle

dependencies {
    compile 'com.android.support:support-v4:21+'
    compile 'com.google.android.gms:play-services:6.+'
    compile 'com.android.support:appcompat-v7:21+'
    compile 'com.android.support:recyclerview-v7:+'   /// if i take it off the tracker works
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project('libs:ViewPageIndicator')
}

And in my MyApplication I have this:

 public synchronized Tracker getTracker(TrackerName trackerId) {
    if (!mTrackers.containsKey(trackerId)) {

        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        Tracker t =analytics.newTracker("XX-XXXXX");
        mTrackers.put(trackerId, t);

    }
    return mTrackers.get(trackerId);
}

I have test it with 4.1.2 and it doesn't work & with 5.0.2 and it works.

Using Android Studio 1.0.1

Upvotes: 2

Views: 836

Answers (1)

charliebeckwith
charliebeckwith

Reputation: 1449

If you are using proguard, then the most likely fix will be adding this to your proguard file

-keep class com.google.android.gms.** {*;}

Upvotes: 1

Related Questions