Search code examples
androidcontinuous-integrationtravis-cicontinuous-deployment

Android Apk Deployment to Github Releases With Travis


I configured my .travis.yml file to build and deploy my application to github releases. While the application builds successfully and seemingly everything goes smoothly (no error message in travis logs)

I only get a message as a result which indicates deploy is failed. I read somewhere that using travis for free works for public repositories only and mine is a private repository. Can it be the reason or am I missing something? For completeness:

#app level gradle

    task printVersionName {
        doLast {
            println android.defaultConfig.versionName
        }
    }

Here is the related part of .travis.yml

before_install:
  - openssl aes-256-cbc -K .. (I would assume this part is correct because when it wasn't I got an error from here)
    script:
      - "./gradlew assembleRelease"
    before_deploy:
      - export APP_VERSION=$(./gradlew :app:printVersionName)
    deploy:
      - provider: releases
        api_key: 000000000000 #Of course here is different
        file: app/build/outputs/apk/release/*
        file_glob: true
        skip_cleanup: true
        overwrite: true
        name: "$APP_VERSION"
        tag_name: "$APP_VERSION"
        on:
          branch: travis

Here is the last part of travis log.

> Task :app:lintVitalRelease
> Task :app:assembleRelease
BUILD SUCCESSFUL in 4m 16s
38 actionable tasks: 38 executed
The command "./gradlew assembleRelease" exited with 0.
before_cache.1
0.01s$ rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
before_cache.2
0.01s$ rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache.2
store build cache
before_deploy
10.76s$ export APP_VERSION=$(./gradlew :app:printVersionName)
dpl_0
1.80s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl
Successfully installed dpl-1.10.15
Parsing documentation for dpl-1.10.15
Installing ri documentation for dpl-1.10.15
Done installing documentation for dpl after 0 seconds
1 gem installed
invalid option "--name=To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.10.1/userguide/gradle_daemon.html.\nDaemon will be stopped at the end of the build stopping after processing\n\n> Configure project :app\nWARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getAssemble(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variantOutput.getProcessResources()' is obsolete and has been replaced with 'variantOutput.getProcessResourcesProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variantOutput.getProcessResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variantOutput.getProcessManifest()' is obsolete and has been replaced with 'variantOutput.getProcessManifestProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variantOutput.getProcessManifest(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getMergeResources(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getMergeAssets()' is obsolete and has been replaced with 'variant.getMergeAssetsProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getMergeAssets(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getPackageApplication()' is obsolete and has been replaced with 'variant.getPackageApplicationProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getPackageApplication(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nWARNING: API 'variant.getPreBuild()' is obsolete and has been replaced with 'variant.getPreBuildProvider()'.\nIt will be removed at the end of 2019.\nFor more information, see https://d.android.com/r/tools/task-configuration-avoidance.\nTo determine what is calling variant.getPreBuild(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\nregisterResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)\n\n> Task :app:printVersionName\n1.0013\n\nBUILD SUCCESSFUL in 10s\n1 actionable task: 1 executed"
failed to deploy

What can be the cause of my error? I looked at the 6039 lines of output in travis but I am %99.99 sure that there is no clear message which indicates the reason for the failure of deployment.

Funny thing is if I change travis.yml's deploy to a simpler one, build succeeds but deployment is still not done since build is not tagged

Simplified .travis.yml

deploy:
  - provider: releases
    api_key: 000000000
    file: app/build/outputs/apk/release/*
    file_glob: true
    skip_cleanup: true
    overwrite: true
    name: "$APP_VERSION"
    tag_name: "$APP_VERSION"
    on:
      branch: travis

This information may help to examine the problem in a smaller area.


Solution

  • It seems

     name: "$APP_VERSION"
                tag_name: "$APP_VERSION
    

    isn't accepted in travis build anymore. I tagged the build with the following.

     before_deploy:
    
          - git tag "Your custom tag"