Deploying Android apk to hockeyapp can't open apk file


#1

I tried to use .yml from Deploying Android apk to hockeyapp
But I’m getting:

curl: (26) couldn’t open file “app/build/outputs/apk/debug/app-debug.apk”
Exited with code 26

My deployHockeyApp.sh:

function uploadToHockeyApp {

  GIT_COMPARE_KEY=${CIRCLE_COMPARE_URL##*/}
  GIT_PRETTY_COMMIT_LOG=$(echo "<ul>$(git log ${GIT_COMPARE_KEY} --pretty=format:'<li>[%ad] %s (%an)</li>' --date=short)</ul>" | tr -d '\n')

  HOCKEYAPP_NOTES_HEADER="**Built on:** $(date +"%a %d-%b-%Y %I:%M %p")
  **Branch:** $(git rev-parse --abbrev-ref HEAD)
  **Commit:** $(git rev-parse --short HEAD)"

  HOCKEYAPP_NOTES_HEADER_HTML=${HOCKEYAPP_NOTES_HEADER//$'\n'/<br>}
  HOCKEYAPP_NOTES="${HOCKEYAPP_NOTES_HEADER_HTML} ${GIT_PRETTY_COMMIT_LOG}"

  curl --verbose \
       --fail \
       --form "status=2" \
       --form "notify=1" \
       --form "notes=${HOCKEYAPP_NOTES}" \
       --form "platform=Android" \
       --form "notes_type=0" \
       --form "ipa=@${HOCKEYAPP_EXPORT_APK_PATH}" \
       --form "tags=${HOCKEYAPP_TAGS}" \
       --form "teams=${HOCKEYAPP_TEAM_ID}" \
       --form "release_type=2" \
       --header "X-HockeyAppToken: ${HOCKEYAPP_TOKEN}" \
       "https://upload.hockeyapp.net/api/2/apps/${HOCKEYAPP_APP_IDENTIFIER}/app_versions/upload"
}

My config:

version: 2
references:
  save_workspace_artifacts: &save_workspace_artifacts
    store_artifacts:
      path: outputs/outputs/apk
  attach_workspace_artifacts: &attach_workspace_artifacts
    attach_workspace:
      at: outputs
jobs:
  build:
    working_directory: ~/code
    docker:
    - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
    - 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:
        paths:
        - ~/.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
        paths:
        - outputs
    #      - store_test_results:
    #          path: app/build/test-results
    # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples

  deploy:
    docker:
    - image: circleci/node:latest
    steps:
    - checkout
    - *attach_workspace_artifacts
    # storing to be visible on api as an outcome of the last build
    - *save_workspace_artifacts
    - run:
        name: Chmod permissions
        command: chmod +x ./deployHockeyApp.sh
    - run:
        name: Deploy to hockey app
        command: source ./deployHockeyApp.sh; uploadToHockeyApp

workflows:
  version: 2
  build-and-deploy:
    jobs:
    - build
    - deploy:
        requires:
        - build
        filters:
          branches:
            only: master

Any ideas?