一、ubuntu16安装ndk
wget -c https://dl.google.com/android/repository/android-ndk-r20-linux-x86_64.zip
unzip android-ndk-r20-linux-x86_64.zip
export PATH=$PATH:~/android_ndk/android-ndk-r20
二、安装cmake
sudo apt-get install cmake
三、ubuntu 16 安装clang7.0
apt install build-essential xz-utils curl
curl -SL http://releases.llvm.org/7.0.1/clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar -xJC .
sudo cp -r clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-16.04/ /usr/local/clang-7.0.1
export LD_LIBRARY_PATH=/usr/local/clang-7.0.1/lib:$LD_LIBRARY_PATH
export PATH=/usr/local/clang-7.0.1/bin:$PATH
sudo ldconfig
四、编译
进入目录epic/library/src/main/cpp,修改buile_with_cmake
#! /bin/sh
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_SDK/ndk-bundle/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN=clang -H. -Bbuild && cd build && make
# DANDROID_TOOLCHAIN = gcc ==> clang, Android 已经不再支持gcc
执行./build_with_cmake,如果没出现问题在当前目录下会生成build目录,里边会有libepic.so