How to expose the apk uploaded to crashlytics generated by fastlane

Hi I recently imported an android project on bitrise and created a workflow for it

Since the project already has fastlane added.

My fastlane about building apk and uploading is like this

lane :crashlytics_stagingDebug do
  # build the release variant
  build_android_app(task: "assembleStagingDebug")

  # upload to Beta by Crashlytics
  crashlytics(
    api_token: "adsfasdfasdfhasghjklfashgjkhdafjkghjkaghjkahsg",
    build_secret: "ajsdklfjklasdfjklasdjflkasdjklfjaslkdjflkasdjfkljaslkdfjklsdajfklsadjflkadsj"
  )
end

So in the workflow, I use fastlane to execute “assembleStagingDebug”. But it seems that the apk got directly uploaded to crashlytics. The following Step “Deploy to bitrise.io” doesn’t upload any apk to it.

I assume that the “Deploy to bitrise.io” doesn’t know that apk generated by fastlane. May I ask how should I configure the “Deploy to bitrise” to also attach the generated apk in bitrise?

Thanks a lot

Hi @xiao-nirovision,

There are two ways:

  1. Either move the APK into the $BITRISE_DEPLOY_DIR, which is the default dir deployed by Deploy to Bitrise.io step . You can of course do this in your fastlane config too, moving or copying the APK, you can get the $BITRISE_DEPLOY_DIR environment variable’s value with ENV['BITRISE_DEPLOY_DIR'] in Ruby.
  2. Or change the path which should be deployed in the Deploy to Bitrise.io step to the path where you store the APK (e.g. something like $BITRISE_SOURCE_DIR/build/.../app.apk

Related docs: https://devcenter.bitrise.io/tips-and-tricks/attach-any-file-to-build/

If you’d have any questions just let us know! :wink:

P.S.: on the screenshot you linked I saw that you already change the “Deploy directory of file path” option of the Deploy to Bitrise.io step, so either set that to the right path (where the APK is stored) or change it back to the default $BITRISE_DEPLOY_DIR and go with the #1 point.

Hey @viktorbenei

Thanks so much for answering, I will try your first solution and let you know how it goes.

As for the second solution, the reason I kind of want to avoid using it is that I have different flavors with my app which will have different output folder.

But thanks so much anyway

Xiao

1 Like

Cool, it works. Thanks @viktorbenei

1 Like

Glad to hear! :wink: Happy Building!