Q:

Travis: how to know android sdk/ndk path?

My android project is built with Ant and i have to edit ant.properties manually file to pass sdk.path variable pointing to android sdk directory. i'm going to change it to get sdk path from environment variable to make build possible on Travis CI. What is android sdk variable for this? 
Also i have some jni code to be built with android ndk, so the similar question - what is env variable for android ndk on Travis?

A:

Don't use the Travis's Android support; it uses the old 'android' CLI instead of the new sdkmanager CLI that supports installing the NDK.  Do something like:
before_install:
 - cd $HOME
 - wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O $HOME/android-sdk.tgz
 - mkdir android
 - unzip android-sdk.tgz -d android/sdk
 - export PATH=$PATH:$HOME/android/sdk/tools:$HOME/android/sdk/tools/bin
 - cd build/<your-build-directory>

And then in the 'install' section:
install:
  - echo y | sdkmanager 'ndk-bundle'
  - echo y | sdkmanager 'cmake;3.6.3155560'
  - export ANDROID_HOME=$HOME/android/sdk
  - export ANDROID_NDK_HOME=$HOME/android/sdk/ndk-bundle

You can use the sdkmanager to install anything else you need. The benefit over the other answer is that this will grab the latest version of the NDK. 
Finally, then you can set the environment variables ANDROID_HOME and ANDROID_NDK_HOME, and pass it to your specific environment.
Hope it helps.

