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

标签 android proguard flurry

当使用 ProGuard 构建要在 Google Play 中发布的应用时,我的应用无法获取 flurry 广告。如果我在没有 ProGuard 的情况下运行应用程序,则一切正常。 我启用 Log 和 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$4.a(Unknown Source)
02-20 16:31:17.960    8953-9041/? W/System.err﹕ at com.flurry.sdk.ci$4.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$1.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无法转换为com.flurry.android.impl.ads.protocol.v13.AdUnit ”。

我联系了 Flurry 支持人员,[email protected] ,两个工作日后(今天),他们回复说:

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

关于android - 使用 ProGuard 无法获取广告、Flurry 5.3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28629057/

相关文章:

java - 延迟发布通知

android - 我如何教 ProGuard 摆脱它保留的我不使用的东西?

android - 资源 NotFoundException

java - 应用程序在 1.6 上完美运行,但为什么我在运行 1.6 的 Xperia X10 上收到 java.lang.VerifyError 错误?

android - Flurry 未集成到 Android 应用程序中

java - 我的代码将目录检测为文件并将文件检测为目录

android - 上下文操作模式自定义行为

android - 发布前缩小图片尺寸

android - 无法使用 admob 中介检索困惑广告

ios - 与 iOS 应用程序的 Flurry 集成导致链接错误