无法使用 ProGuard 获取广告、Flurry 5.3

Can't get Ad, Flurry 5.3 with ProGuard

我的应用程序无法在 google 中发布 ProGuard 时获得 flurry 广告。如果我 运行 没有 ProGuard 的应用程序一切正常。 我启用日志和 flurry SDK 写入下一条信息:

02-20 16:31:09.765    8953-8953/? D/FlurryAdServingApp﹕ fetchAndDisplay: Banner
02-20 16:31:14.885    8953-8953/? D/FlurryAdServingApp﹕ Failed 20
02-20 16:31:17.960    8953-9041/? W/System.err﹕ java.lang.ClassCastException: com.flurry.sdk.it cannot be cast to com.flurry.android.impl.ads.protocol.v13.AdUnit
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.ci.a(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.ci.a(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.gg.o(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.gg.d(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.gg.a(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.gh.o(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.gh.a(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.gg.a(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.hk.run(Unknown Source)

我不明白他为什么写未知来源如果在 proguard-project.txt 我接下来写:

-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod
-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.**

请帮帮我。

我有完全相同的错误消息,"W/System.err﹕ java.lang.ClassCastException: com.flurry.sdk.it cannot be cast to com.flurry.android.impl.ads.protocol.v13.AdUnit"。

我联系了 Flurry 支持,support@flurry.com,2 个工作日后(今天),他们回答说:

Thank you for contacting Flurry support. In your proguard config, could you please change the 3rd line from:

-keepattributes *Annotation*,EnclosingMethod

to

-keepattributes *Annotation*,EnclosingMethod,Signature

Note the addition of "Signature". Please try this new configuration and let us know if it works.

我对 Proguard 进行了调整,Flurry 广告现在似乎可以正常工作了。 总结一下,我的 Flurry Proguard 配置如下:

#Flurry
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}
# Preserve Flurry mediation classes for DFP/AdMob Ads
-keep public class com.google.ads.mediation.flurry.**

作为参考,我使用的是 FlurryAds-5.3.0.jar、FlurryAnalytics-5.3.0.jar 和 flurryAndroidDFPandAdMobMediationAdapter-5.0.0.r1.jar