Errors when initializing flurry for android

4.6k views Asked by At

I’m using FlurryAnalytics-5.5.0.jar. When I initialize Flurry, I receive some errors:

FlurryAgent.setLogEnabled(true);
FlurryAgent.setLogEvents(true);
FlurryAgent.setLogLevel(android.util.Log.ERROR);
FlurryAgent.init(this, FLURRY_ID);

Errors:

Could not find class 'com.flurry.sdk.br', referenced from method com.flurry.sdk.bq.a

and

There is a problem with the Google Play Services library, which is required for Android Advertising ID support. The Google Play Services library should be integrated in any app shipping in the Play Store that uses analytics or advertising.

Can you please advise?

2

There are 2 answers

4
Edson Menegatti On

If you're using Proguard, the Flurry guide page tells it is necessary to add the following lines to you proguard config file:

-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

# Google Play Services library
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *

-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

#If you are using the Google Mobile Ads SDK, add the following:
# Preserve GMS ads classes
-keep class com.google.android.gms.ads.** { *;
}
-dontwarn com.google.android.gms.ads.**


#If you are using the InMobi SDK, add the following:
# Preserve InMobi Ads classes
-keep class com.inmobi.** { *;
}
-dontwarn com.inmobi.**
#If you are using the Millennial Media SDK, add the following:
# Preserve Millennial Ads classes
-keep class com.millennialmedia.** { *;
}
-dontwarn com.millennialmedia.**

Also take a look at this answer.

1
txedo On

This problem arises because Google Play Services are not property configured. Check that any play-services core dependency is not missing in your project configuration.

In my case, I solved it by adding the following dependency to build.gradle config file (app level):

compile 'com.google.android.gms:play-services-base:8.4.0'

The exact logcat error lines are the following

E/FlurryAgent: GOOGLE PLAY SERVICES EXCEPTION: com.google.android.gms.common.GooglePlayServicesUtil

E/FlurryAgent: There is a problem with the Google Play Services library, which is required for Android Advertising ID support. The Google Play Services library should be integrated in any app shipping in the Play Store that uses analytics or advertising.

and the GooglePlaySercicesUtil class is found in the play-services-base library.

Hope this helps.

See links this and this for more information.