Fabric/Crashlytics on Android - How to have two different crashlytics projects with the same package name?

前端 未结 2 2089
轮回少年
轮回少年 2021-02-14 12:38

I am developing an Android application and I want to have two different projects in Crashlytics / Fabric (debug and release).

I know that this is possible by having two

2条回答
  •  南笙
    南笙 (楼主)
    2021-02-14 13:23

    There is also an option where you do not need to create multiple organizations. You can use the Fabric.Builder with appIdentifier(java.lang.String appIdentifier).

    The only thing to do is replace the Crashlytics initialization from the documentation

    Fabric.with(this, new Crashlytics());
    

    with something like this:

    final String trackingId = BuildConfig.APPLICATION_ID + ".tv";
    Fabric fabric = new Fabric.Builder(this).kits(new Crashlytics()).appIdentifier(trackingId).build();
    Fabric.with(fabric);
    

    The second snippet uses projects APPLICATION_ID (package name) and adds a ".tv" to it.

    NOTE: when you track your crashes this way, Crashlytics does not create the project by itself. It is important to have the project created manually (or having the project already created from another App with the same package name).

提交回复
热议问题