Trying to run my maven project for testing UI in android application. To prepare execution I need to run appium and run emulator. I can do all this on my local env from bash script. As project is on github I would like to use travis. This is appium/selenium/testng/java project. I’m not sure if I have .travis.yml with “language: android” or should I start with “language: java”. Anyway all components I install success but when I want to execute android sdk manager I can see this:
The Android recipes/cookbook is desperately old and seemingly not maintained at the moment.
My advice is to manually set-up the sdkmanager CLI and let the Android Gradle plugin automatically download all nessesary dependencies. This feature is supported starting from Android Gradle 3.3 (https://developer.android.com/studio/intro/update#download-with-gradle). So it’s even easier than what @karcio described (you don’t need to tell Travis CI the SDK Plattform or Build Tools Version).
You can even use the language: minimal since it ships Java 8 to get the fastest possible boot times:
language: minimal
os: linux
dist: xenial
group: edge
env:
global:
# for updates check developer.android.com/studio#downloads (current 26.1.1)
- ANDROID_SDK_TOOLS=sdk-tools-linux-4333796.zip
before_install:
# set JAVA_HOME path
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# download and unzip Android SDK command line tools
- wget -nv https://dl.google.com/android/repository/$ANDROID_SDK_TOOLS
- unzip -q $ANDROID_SDK_TOOLS -d $HOME/sdk
# set SDK tools path variable and ANDROID_HOME
- export PATH=$PATH:$HOME/sdk/tools/bin
- export ANDROID_HOME=$HOME/sdk
# create empty cfg file to prevent sdkmanager warning message
- mkdir -p $HOME/.android && touch $HOME/.android/repositories.cfg
install:
# accept licenses for all available packages that have not already been accepted
- yes | sdkmanager --licenses >/dev/null
before_script:
# set executable flag for gradle wrapper
- chmod +x gradlew
# create dir for gradle settings
- mkdir -p $HOME/.gradle
# disable gradle daemon for current user
- echo "org.gradle.daemon=false" >> $HOME/.gradle/gradle.properties
# set gradle log format to plain
- echo "org.gradle.console=plain" >> $HOME/.gradle/gradle.properties
My build config also stopped working in the last days. Travis support estimated, that my machine got migrated to xenial ( i had no dist set). after adding “dist: trusty” the enviromant hat a working android-update-sdk again.
@stowy the build you linked to is all cancelled with no logs and I don’t see any relevant failures in other recent builds.
Testing dist: xenial does show the subj error. So adding dist: trusty should fix it. In the tests, I never got xenial when I omitted dist: with language: android but I guess this happens randomly.
Thanks @native-api again! I have currently migrated to @G00fY2’s solution which works for me, but if I can make some changes to make the android solution work again then I’ll test that out.
The language: android cookbook has not been updated for more than 2 years and still has preinstalled SDK Tools, Build-Tools and SDK Version 25: android-sdk version 0.2.2
I don’t see much sense in sticking with that when you have to update all dependencies anyway and are forced to use an old distribution.
Also the components like extra-google-google_play_services, extra-google-m2repository and extra-android-m2repository are outdated/unnecessary, since Google moved the dependencies to their own Google Maven servers (the google() repository in your build.gradle).