Deploying Android apk to hockeyapp

Anyone know the command to be used in circle.yml to deploy output of Android build (APK) to hockeyapp? I looked at the docs and forums but didn’t find a solution. Thanks!

This circle.yml code should do the trick:

    - sudo gem install shenzhen
    - ./scripts/
    - ipa build -c Distribution
    - ./scripts/
    branch: master
      - ipa distribute:hockeyapp -m "circleci build" --token $HOCKEYAPP_TOKEN


Tried that but didn’t work. Ultimately ended up writing a custom deploy script that does curl upload to hockey. Thanks for the answer anyway!

1 Like

Sorry I wasn’t able to help. Would you be willing to share your script? It might be helpful to others.

I also wasn’t able to use that method, and ended up rolling with my own script. Here’s what I did:


    branch: develop
      - ./

curl \
-F "status=2" \
-F "notify=0" \
-F "ipa=@AppName/build/outputs/apk/appname-dev-debug.apk" \
-H "X-HockeyAppToken: $HockeyAppToken" \$AndroidAppId_Dev/app_versions/upload

@drazisil The script posted above by @dmaltsiniotis is exactly what I ended up writing.

Where do you find the location of your apk on circleci?

I want to upload specific builds ( verified builds) of circle ci on Hockey not all . How it can be automated with the help of above scripts.

Thanks in advance.

Thanks to dmaltsiniotis for the script. I am able to successfully upload my multiple android apks simultaneously to hockey.
Here are the steps. Hope it will help others.

  1. First we need to get below parameter value :
    (a) Hockey app token - hockey api token which you can get from hockey dashboard
    (b) hockey app id- hockey app channel id to which you want to upload

  2. Add all above parameters as Environment variables in circle ci dashboard as below:

  3. Go to your circle.yml file and add below code
    branch: /deploy-.*/

  4. add file at the same place with circle.yml:

-F “status=2”
-F “notify=1”
-F “ipa=@APK FULL PATH(projectname/build/outputs/apk/APK_NAME”
-H “X-HockeyAppToken: $HOCKEYAPP_TOKEN”$AndroidFirstAppId/app_versions/upload
-F “status=2”
-F “notify=1”
-F “ipa=@APK FULL PATH(projectname/build/outputs/apk/APK_NAME”
-H “X-HockeyAppToken: $HOCKEYAPP_TOKEN”$AndroidSecondAppId/app_versions/upload

trigger build :slight_smile:

I have one query in this process. for now this deployment will trigger when there is specified branch name or tag. is there any method in which we can mention in commit message that deployment should be taken or not

1 Like

This thread helped me to setup both the circleci and hockeyapp for me and its working perfectly. But I wonder how I can send the build ID or the build number to hockey app from circleci as an extra information so that tester. Now I am not able to recognize which build was generated from which commit.

-F “repository_url=$CIRCLE_REPOSITORY_URL”
-F “build_server_url=$CIRCLE_BUILD_URL”
-F “commit_sha=$CIRCLE_SHA1” \

This is how I figured out to pass on some kind of tags.

Thanks halfer. Have provided formatted yaml file :slight_smile:

Great stuff. Paste your YAML here - it looks like it does not validate. That’d need to be fixed and re-committed in your repo.

You cannot run scripts directly unless they have an appropriate execute bit set, although it seems you have tried that, so it is odd that that did not work. However, you can make it easier just by calling them in a shell command:

sh ./
1 Like

Many thanks @halfer

my deploy script it running now. But I am getting error
#!/bin/bash -eo pipefail
sh ./
curl: (26) couldn’t open file “app/build/outputs/apk/app-debug.apk”
Exited with code 26

Below is my

curl \
-F "status=2" \
-F "notify=1" \
-F "ipa=@${2:-app/build/outputs/apk/debug/app-debug.apk}" \
-H "X-HockeyAppToken: <hockey-app-token>" \<app-id>/app_versions/upload

As mentioned in my previous post for 1 of 2 failing builds, 3 targets are executed as follows:

  1. Spin up Environment
  2. Checkout code
  3. Deploy to hockey app

"Since while running “Deploy to hockey app” build target was not run till time and hence app-debug should not be available.

Any idea how can I solve this? Is it expected behavior to have 2 builds running on Circle CI(I believe that could be because I am now using workflows and deploy is dependent on build)

I am guessing this is created in your build job, and you are wanting to make use of it in your deploy job. By default, each job gets a clean build container, so your artefact will have gone. I suspect you will benefit from Workspaces to preserve this directory - see the manual.

Ah, I just spotted why this did not work - it is in the wrong job. Any changes you make in a build job are not automatically preserved for other jobs in the same workflow. Although you could move this step to the other job (since you presumably do not need it for building) it is now redundant, so I would recommend removing it.

1 Like

Thanks @halfer for all your help. I have deployed my build successfully. :slight_smile:

Excellent, and you’re welcome. Please do explain how you did so, for the benefit of future readers :slightly_smiling_face:.

Re posting working yaml

version: 2
  save_workspace_artifacts: &save_workspace_artifacts
      path: outputs/outputs/apk
  attach_workspace_artifacts: &attach_workspace_artifacts
      at: outputs
    working_directory: ~/code
      - image: circleci/android:api-25-alpha
      JVM_OPTS: -Xmx3200m
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
         name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
         command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
#      - run:
#          name: Run Tests
#          command: ./gradlew lint test
      - run:
          name: Build Code
          command: ./gradlew assembleDebug
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_artifacts:
          path: app/build/outputs
          destination: apk
      - persist_to_workspace:
          root: app/build
            - outputs
#      - store_test_results:
#          path: app/build/test-results
      # See for deploy examples
      - image: circleci/node:latest
      - checkout
      - *attach_workspace_artifacts
      # storing to be visible on api as an outcome of the last build
      - *save_workspace_artifacts
      - run:
          name: Deploy to hockey app
          command: sh ./
  version: 2
      - build
      - deploy:
            - build
              only: master
1 Like