Why does Travis CI download everything every time it builds?
We talk about this here , Travis-ci downloads cache from S3, so there is no significant speed improvement caching large files like Android SDK.
How to enable Android SDK in Travis-ci cache? (Not recommended)
The relevant bits are here, you can add any file you like to the cache and find its path:
cache: directories: - ${TRAVIS_BUILD_DIR}/gradle/caches/ - ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/ - ${TRAVIS_BUILD_DIR}/android-sdk/extras/
I did this a while ago, you can see the code in the link shared by @ nicolas-f :
language: android jdk: oraclejdk8 env: global: - GRADLE_USER_HOME=${TRAVIS_BUILD_DIR}/gradle - ANDROID_HOME=${TRAVIS_BUILD_DIR}/android-sdk - SDK=${TRAVIS_BUILD_DIR}/android-sdk - PATH=${GRADLE_USER_HOME}/bin/:${SDK}/:${SDK}/tools/:${SDK}/platform-tools/:${PATH} before_install: - export OLD_SDK=/usr/local/android-sdk-24.0.2; mkdir -p ${SDK}; cp -u -R ${OLD_SDK}/platforms ${SDK}/platforms; cp -u -R ${OLD_SDK}/system-images ${SDK}/system-images; cp -u -R ${OLD_SDK}/tools ${SDK}/tools cache: apt: true directories: - ${TRAVIS_BUILD_DIR}/gradle/caches/ - ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/ - ${TRAVIS_BUILD_DIR}/android-sdk/extras/ android: components:
Use ls to confirm that the SDK path has not changed at another time.
There is currently no need to move the SDK, and you need to update other things, maybe add another tools after platform-tools , this code is deprecated.
source share