Fabric Crashlytics / Answers没有显示 - 安装Fabric作为android库的一部分

时间:2017-08-16 20:35:16

标签: android crashlytics google-fabric crashlytics-android

我被要求进行此设置:在2个不同的回购中有2个android项目。其中一个项目是Android库,另一个是(或多个)android应用程序,导入库。 这是在不同的repos中设置的,因此它不是具有库模块的应用程序,反之亦然。

Android库拥有我们在公司中使用的所有潜在分析工具,然后应用程序项目只会导入android库,并初始化它想要报告的任何分析提供程序。

到目前为止,一切都“有效”,但我没有看到任何数据出现在Fabric的网站上。

以下是我如何设置库的重要部分:

项目级别build.gradle

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

        // fabric
        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.22.1'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
}

然后是应用级build.gradle文件:

apply plugin: 'com.android.library'

repositories {
mavenLocal()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }

dependencies {
    // fabric
    compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:answers:1.3.13@aar') {
        transitive = true;
    }
}
apply plugin: 'io.fabric'

最后,应用程序的AndroidManifest.xml文件包含apiKey:

<meta-data
    android:name="io.fabric.ApiKey"
    android:value="xxxxxxxxxxxxx8888xxx"
    />

图书馆初始化Crashlytics / Answers,就像这样(这只是一个测试,所以现在一切都很脏):

final Fabric fabric = new Fabric.Builder(context)
        .kits(new Crashlytics(), new Answers())
        .debuggable(true)
        .build();
Fabric.with(fabric);
Crashlytics.setUserIdentifier("55555");
Crashlytics.setUserEmail("eduardo@test.com");
Crashlytics.setUserName("EduardoTest");
Answers.getInstance().logCustom(new CustomEvent("Played Song"));
Answers.getInstance().logCustom(new CustomEvent("Played Song")
        .putCustomAttribute("Custom String", "My String")
        .putCustomAttribute("Custom Number", 25));

我运行应用程序,日志显示:

sample_app I/CrashlyticsCore: Initializing Crashlytics 2.3.17.dev
sample_app D/CrashlyticsCore: Installer package name is: null
sample_app D/Beta: Beta by Crashlytics app is not installed
sample_app D/CrashlyticsCore: Exception handling initialization successful
sample_app D/Fabric: Initializing io.fabric.sdk.android:fabric [Version: 1.3.17.dev], with the following kits:
                                                                           com.crashlytics.sdk.android:beta [Version: 1.2.5.dev]
                                                                           com.crashlytics.sdk.android:answers [Version: 1.3.13.dev]
                                                                           com.crashlytics.sdk.android:crashlytics [Version: 2.6.8.dev]
                                                                           com.crashlytics.sdk.android.crashlytics-core [Version: 2.3.17.dev]

sample_app D/CrashlyticsCore: Opening a new session with ID 123123-1231-12331-123123
sample_app D/Fabric: Requesting settings from https://settings.crashlytics.com/spi/v2/platforms/android/apps/com.ancestry.analytics_sample_app/settings
sample_app D/Fabric: Loaded settings:<some settings payload>
sample_app D/CrashlyticsCore: Initialization marker file created.
ample_app D/CrashlyticsCore: Finalizing previously open sessions.
sample_app D/CrashlyticsCore: No open sessions to be closed.
sample_app D/CrashlyticsCore: Closed all previously open sessions
sample_app D/CrashlyticsCore: Starting report processing in 1.0 second(s)...
sample_app D/CrashlyticsCore: Initialization marker file removed: true
sample_app D/CrashlyticsCore: Checking for crash reports...
sample_app D/CrashlyticsCore: No reports found.
08-16 14:18:09.354 16431-16431/? D/libcrashlytics: Initializing libcrashlytics version 1.1.5
08-16 14:18:09.354 16431-16431/? D/libcrashlytics: Attempting to load unwinder...
08-16 14:18:09.365 16431-16431/? D/libcrashlytics: Done; using libunwind
08-16 14:18:09.365 16431-16431/? D/libcrashlytics: Attempting to register signal handler...
08-16 14:18:09.365 16431-16431/? D/libcrashlytics: Signal handler registered.
08-16 14:18:09.366 16431-16431/? D/libcrashlytics: Initializing native crash handling successful.
08-16 14:18:09.373 16431-16431/? I/CrashlyticsCore: Initializing Crashlytics 2.3.17.dev                                                                

有关为什么没有出现在Fabric方面的任何建议或反馈?

谢谢!

0 个答案:

没有答案