Reputation: 79
I have an Android lib project that has some C code that it depends on. In order for it to compile it needs to run compileNdk...
task.
Setting up the NDK locally is pretty straightforward. However, getting it to work with circleci is not so straightforward. The circleci docs have a good amount of info on how to install the android SDK properly but there is nothing on how to properly install NDK on circleci.
What is the best way to install the Android NDK on circleci so it can successfully build/compile with my continuous integration setup?
Upvotes: 1
Views: 1386
Reputation: 16195
For anyone looking now, at the time of writing, CircleCI still does not bundle the NDK in the 14.04 environment.
However, you can add it manually and cache it
dependencies:
cache_directories:
- ~/android-ndk-r11c
pre:
- if [[ ! -e ~/android-ndk-r11c ]]; then wget http://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip && unzip -d ~ android-ndk-r11c-linux-x86_64.zip; fi
And add the environment vars manually:
machine:
environment:
ANDROID_NDK: $HOME/android-ndk-r11c
ANDROID_NDK_HOME: $ANDROID_NDK
PATH: $PATH:$ANDROID_NDK
Upvotes: 1
Reputation: 79
UPDATE: circleci now installs NDK for you.
The best solution I have found so far is to install the NDK via wget and run the bin file. It also requires setting up an environment variable for ANDROID_NDK_HOME.
Here is a sample of what I have successfully running on circleci.
circle.yml
machine:
environment:
ANDROID_HOME: /home/ubuntu/android
ANDROID_NDK_HOME: /home/ubuntu/android/android-ndk
dependencies: cache_directories: - ~/.android - ~/android override: - ./install-dependencies.sh
install-dependencies.sh
if [ ! -e $DEPS ]; then
... &&
wget http://dl.google.com/android/ndk/android-ndk-r10d-linux-x86_64.bin -O $ANDROID_HOME/android-install-ndk.bin &&
chmod a+x $ANDROID_HOME/android-install-ndk.bin &&
cd $ANDROID_HOME && $ANDROID_HOME/android-install-ndk.bin &&
mv $ANDROID_HOME/android-ndk* $ANDROID_HOME/android-ndk
touch $DEPS
fi
Upvotes: -1
Reputation: 167
CircleCI actually installs the NDK. It can be referenced by using the $ANDROID_NDK environment variable.
They explain this at the end of the dependencies section here https://circleci.com/docs/android
Upvotes: 4