5

I have configured a build for an Android project in Bitrise. Now I need to setup automatic deployment for beta testing in Fabric/Crashlytics, just don´t know how to add a step to accomplish that. Any ideas?

Morgan
  • 4,143
  • 27
  • 35
Alejandro Casanova
  • 3,633
  • 4
  • 31
  • 46

3 Answers3

5

The same way you would on your Mac/PC.

You have to configure your project for Fabric/Crashlytics, following their official guides. At the end of the setup (current guide link: https://fabric.io/kits/android/crashlytics/install) you'll have Fabric/Crashlytics integrated into your Gradle project.

After the setup, to deploy to Fabric/Crashlytics, just run any of the Gradle tasks which invoke the Fabric/Crashlytics deploy.

On bitrise.io / with bitrise CLI you can run the Gradle task e.g. with the Gradle Runner step (or with a Script step).

Viktor Benei
  • 3,447
  • 2
  • 28
  • 37
  • If in a previous workflow step I'm signing the unsigned APK with a Keystore, how can I tell this new gradle task to select that new signed APK for running the Fabric deployment? I'm always getting an error about "Crashlytics halted compilation because it can't distribute the unsigned APK: /bitrise/src/Application/build/outputs/apk/Application-release-unsigned.apk" – nano Apr 24 '17 at 15:31
  • "If in a previous workflow step I'm signing the unsigned APK" - if you follow their guide then you should run the related Gradle task, not just specifying a previously generated .apk (AFAIK). The Crashlytics specific gradle task should take care of the Crashlytics related/required signing (AFAIK a simple debug signing). – Viktor Benei Apr 24 '17 at 17:55
2

Thanks to @Viktor's answer I managed to figure out the exact steps to autmatically upload the apk to Crashlytics-Beta from Bitrise. Here are the details.

  1. Click your build definition, then Workflows tab and finally Manage Workflows button.
  2. Add a new environment variable, for that click the green "Manage env. vars" button, add a new environment variable named "GRADLE_TASK_RELEASE" or whatever name suits you, then set its value to "assembleRelease crashlyticsUploadDistributionRelease" and close the environment variables window.
  3. Select the Gradle Runner step to edit it. Inside the section "Gradle task to run", change the value and put the recently created variable "$GRADLE_TASK_RELEASE", save the changes and you will be good to go.

At the end of the step in the log something like the following:

Uploading /bitrise/src/YOUR_PROJECT/build/outputs/apk/YOUR_PROJECT-release.apk to Crashlytics...
Alejandro Casanova
  • 3,633
  • 4
  • 31
  • 46
1

Just add assembleRelease crashlyticsUploadDistributionRelease to your gradle task.

FelixSFD
  • 6,052
  • 10
  • 43
  • 117
Alex
  • 11
  • 3