【问题标题】:Errors when initializing flurry for android为android初始化flurry时出错
【发布时间】:2017-07-17 20:31:18
【问题描述】:

我正在使用 FlurryAnalytics-5.5.0.jar。当我初始化 Flurry 时,我收到一些错误:

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

错误:

找不到从方法引用的类“com.flurry.sdk.br” com.flurry.sdk.bq.a

Google Play 服务库存在问题,即 Android 广告 ID 支持所必需的。 Google Play 服务 库应集成在 Play 商店中的任何应用程序中 使用分析或广告。

你能建议吗?

【问题讨论】:

  • 第二条消息是让您知道您需要将 Google Play 服务库添加到您的应用程序中。或者至少是 GPS 的广告部分。

标签: android runtime-error flurry


【解决方案1】:

出现此问题是因为 Google Play 服务未配置属性。检查您的项目配置中是否缺少任何 play-services 核心依赖项。

就我而言,我通过将以下依赖项添加到 build.gradle 配置文件(应用级别)来解决它:

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

确切的 logcat 错误行如下

E/FlurryAgent:GOOGLE PLAY 服务例外:com.google.android.gms.common.GooglePlayServicesUtil

E/FlurryAgent:Android 广告 ID 支持所需的 Google Play 服务库存在问题。 Google Play 服务库应集成到 Play 商店中使用分析或广告的任何应用程序中。

GooglePlaySercicesUtil 类位于 play-services-base 库中。

希望这会有所帮助。

有关详细信息,请参阅链接 thisthis

【讨论】:

  • 即使我有 implementation 'com.google.android.gms:play-services-basement:18.0.0' ,我仍然看到这个警告(甚至多次)。这个警告甚至意味着什么?我应该担心吗?
【解决方案2】:

如果您使用 Proguard,Flurry guide page 会告诉您有必要在您的 proguard 配置文件中添加以下行:

-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.**

也看看这个answer

【讨论】:

  • 我没有使用 Proguard
  • 类似建议更新“Google Play 服务”。更新后“Google Play 服务库有问题”的错误信息消失了!谢谢。消息“Could not find class 'com.flurry.sdk.bp', referenced from method com.flurry.sdk.bq.a”是 steel accrue。
  • 我正在使用 Proguard 而不是在我的应用程序中使用广告。我该如何解决?你能告诉我gradle 文件结构吗?
  • 我没有 progaurd.cfg 文件。它只是一行proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
猜你喜欢
  • 2015-07-05
  • 2016-09-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多