Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

Travis seems to provide Android support in beta. Android SDK can be found in /usr/local/android-sdk. However it seems that Android NDK is not provided and can't be found in /usr/local/android-ndk. The simple (and expensive walkaround for Travis) is to download/extract/use it right while building like this:

  before_script:
    - export NDK_VERSION=r10e
    - curl -L http://dl.google.com/android/ndk/android-ndk-${NDK_VERSION}-linux-x86_64.bin -O
    - chmod u+x android-ndk-${NDK_VERSION}-linux-x86_64.bin
    - ./android-ndk-${NDK_VERSION}-linux-x86_64.bin > /dev/null
    - rm android-ndk-${NDK_VERSION}-linux-x86_64.bin
    - export ANDROID_NDK_HOME=`pwd`/android-ndk-${NDK_VERSION}
    - export PATH=${ANDROID_NDK_HOME}:${PATH}

Feel free to comment this solution if you have a better one.

Solution 3:

You can export the Android variables using this command as well as Clive Lee's method

env:
  global:
      - ANDROID_HOME=$HOME/android/sdk
      - ANDROID_NDK_HOME=$HOME/android/sdk/ndk-bundle

Post a Comment for "Travis: How To Know Android Sdk/ndk Path?"