Reputation: 25673
I use the sdk-manager-plugin to download my Android dependencies. Unfortunately my Jenkins CI build frequently fails due to "first time download" issues (#47 #10).
I've heard that people workaround this by building their code twice, so that if it fails on the first time then it will pass on the second time.
We've tried to set this up in Jenkins using a conditional step (screenshot below), but if the first step fails it still causes the whole CI job to fail.
Can anybody recommend the best way to set this up?
Upvotes: 3
Views: 3016
Reputation: 25673
The simplest way I've found to workaround this is to run an "Execute shell" step to do an incremental SDK update to ensure the Android SDK components are up to date.
Here's my Jenkins CI config for the build steps:
Here's the command:
(for i in {1..30}; do echo y; sleep 1; done) | /opt/android/android-sdk-linux/tools/android update sdk --all --no-ui --filter \
extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository
One subtlety for my environment (I'm currently using Jenkins in the cloud, using CloudBees): I needed to make sure I did not update the platform-tool
or tool
components, as that caused my builds to frequently become unstable and fail. I'm running a Google Inc.:Google APIs:18
emulator, which has seemed a lot more stable for me than newer ones.
Upvotes: 2
Reputation: 11075
You could use the Naginator plugin to automatically trigger a rebuild if your build fails.
Also, if you have problems with the download you could try setting up a caching proxy server.
Upvotes: 0