loose11
loose11

Reputation: 627

Travis CI can't create a directory for Android SDK

I setup the enviorment for Travis CI and added the .travis.yml to my Source Folder:

language : android

jdk: oraclejdk7

android:
 components:
    - build-tools-19.1.0

    # The SDK version used to compile the project
    - android-19

    - extra-google-google_play_services
    - extra-google-m2repository
    - extra-android-m2repository
    - addon-google_apis-google-19




before_install:
  - chmod +x gradlew

install:
  - true

script: ./gradlew assembleDebug

Travis always download the build-tools etc. but it fails on rename the directory. The output is each time the same:

Installing Archives:

Preparing to install archives

Downloading SDK Platform Android 4.4.2, API 19, revision 4

Installing SDK Platform Android 4.4.2, API 19, revision 4

Failed to rename directory /usr/local/android-sdk/platforms/android-19 to /usr/local/android->sdk/temp/PlatformPackage.old01.

Failed to create directory /usr/local/android-sdk/platforms/android-19

Done. Nothing was installed.

I know Travis CI for Android is beta.

Edit:

I probably know the issue. The problem is because of the SDK 19 is already installed, furthermore I only have to install the build-tools.

Upvotes: 1

Views: 1267

Answers (1)

albodelu
albodelu

Reputation: 7981

Updated response: VM images already include fixed android-wait-for-emulator script and android SDK tools version 24.0.0 by default solving issues.

Build Environment Updates - 2014-12-09

Outdated response:

You are right. If you use container-based infrastructure and you need update to latest tools, you can find here an open issue for this: https://github.com/travis-ci/travis-ci/issues/2848

Default android-sdk folder is located at /usr/local/android-sdk and sudo is disabled. They are working on a Docker/BTRFS implementation that solves this issue.

Ayufan explains there that Docker by default uses AUFS which doesn't support all possible filesystem operations. I don't know the details about this specific issue.

Check my last response at the same link if you need upgrade to latest tools version (23.0.5, required by android-21) before they fix the filesystem/permission issue.

You can copy the android-sdk folder to a folder inside $TRAVIS_BUILD_DIR location using the next work around:

env:
  global:
    - ANDROID_HOME=${TRAVIS_BUILD_DIR}/android-sdk
    - PATH=${ANDROID_HOME}/:${ANDROID_HOME}/tools/:${ANDROID_HOME}/platform-tools/:${PATH}

before_install:
  - cp -R /usr/local/android-sdk-23.0.2 ./android-sdk

http://docs.travis-ci.com/user/ci-environment/#Environment-variables

So you keep already downloaded components and can move the tools folder where the android script and sdkmanager are located.

Other option is to just move the tools folder to a temp folder and update: https://stackoverflow.com/a/8839359/1009132

Or a clean manual installation of latest tools creating two empty folders at the same level for platforms and add-ons using wget etc. The tools link:

https://dl-ssl.google.com/android/repository/tools_r23.0.5-linux.zip

I know you currently don't need this response but probably people will need to install android-21 soon and find this issue.

Upvotes: 2

Related Questions