How to implement Fabric Crashlytics in Android with Bazel?

梦想与她 提交于 2019-12-25 02:18:38

问题


I am able to get crashes using Gradle but when I build the apk using bazel and run it, it crashes as soon as activity is started and in exception I am getting something like this,

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.app/com.xxx.app.ServerConfig}: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
install an Android build tool and ask a team member to invite you to this app's organization.
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2975)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3053)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1772)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:197)
    at android.app.ActivityThread.main(ActivityThread.java:7018)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:514)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:837)
 Caused by: io.fabric.sdk.android.services.concurrency.UnmetDependencyException: This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
install an Android build tool and ask a team member to invite you to this app's organization.
    at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:232)
    at com.crashlytics.android.core.CrashlyticsCore.onPreExecute(CrashlyticsCore.java:205)
    at io.fabric.sdk.android.InitializationTask.onPreExecute(InitializationTask.java:44)
    at io.fabric.sdk.android.services.concurrency.AsyncTask.executeOnExecutor(AsyncTask.java:611)
    at io.fabric.sdk.android.services.concurrency.PriorityAsyncTask.executeOnExecutor(PriorityAsyncTask.java:43)
    at io.fabric.sdk.android.Kit.initialize(Kit.java:69)
    at io.fabric.sdk.android.Fabric.initializeKits(Fabric.java:440)
    at io.fabric.sdk.android.Fabric.init(Fabric.java:384)
    at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:342)
    at io.fabric.sdk.android.Fabric.with(Fabric.java:313)
    at com.xxx.app.ServerConfig.onCreate(ServerConfig.java:246)
    at android.app.Activity.performCreate(Activity.java:7301)
    at android.app.Activity.performCreate(Activity.java:7292)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2928)

回答1:


There is a current solution in tools_android to integrate Crashlytics into Bazel, called crashlytics_android_library. It looks like this:

GOOGLE_SERVICES_RESOURCES = google_services_xml(
    package_name = "com.example.package",
    google_services_json = "google-services.json",
)

crashlytics_android_library(
    name = "crashlytics_lib",
    package_name = "com.example.package",
    build_id = "9dfea8fe-4d75-48a7-ba28-4ddb7fe74780",
    resource_files = GOOGLE_SERVICES_RESOURCES,
)

For more information, see the README in bazelbuild/tools_android.



来源:https://stackoverflow.com/questions/54237225/how-to-implement-fabric-crashlytics-in-android-with-bazel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!