Why does Travis CI download everything every time it builds?

I learned that every time Travis CI builds a project, it must download all the SDKs again, such as tool platforms, support library, current SDK, etc.

Is it possible to avoid this and make Travis reuse what he downloaded for the first time?

I probably made some mistakes in my .travis.yml file, here is a copy of it

language: android android: components: # Uncomment the lines below if you want to # use the latest revision of Android SDK Tools - platform-tools - tools # The BuildTools version used by your project - build-tools-23.0.2 # The SDK version used to compile your project - android-23 # Additional components - extra-android-support - extra-google-google_play_services - extra-google-m2repository - extra-android-m2repository - addon-google_apis-google-19 # Specify at least one system image, # if you need to run emulator(s) during your tests # - sys-img-armeabi-v7a-android-19 # - sys-img-x86-android-17 script: - ./gradlew check - ./gradlew test --continue # - ./gradlew build connectedCheck 
+6
source share
1 answer

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/ # please don't include sys-images 

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: # Update Android SDK Tools - tools - platform-tools - build-tools-23.0.2 - android-23 - add-on - extra script: - ./gradlew check 

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.

0
source

All Articles