apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion '25.0.2' defaultConfig { applicationId 'xyz.nc.android.wc' minSdkVersion 21 targetSdkVersion 25 versionCode 1 versionName '1.0' testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' // ndk default settings for this build ndk { abiFilters 'x86' // abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a' } // set these default settings externalNativeBuild { //arguments "-DVAR_NAME=VALUE" //arguments '-DANDROID_TOOLCHAIN=clang' //arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static', '-DANDROID_PLATFORM=android-21' //arguments '-DANDROID_TOOLCHAIN=gcc', '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-22' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } // this block links Gradle to the CMake (or ndk-build) externalNativeBuild { // cmake build configuration cmake { // relative path to CMake build script //path 'src/main/cpp/CMakeLists.txt' // Passes optional arguments to CMake. //arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" // Sets optional flags for the C compiler. //cFlags "-D_EXAMPLE_C_FLAG1", "-D_EXAMPLE_C_FLAG2" // Sets a flag to enable format macro constants for the C++ compiler. //cppFlags "-D__STDC_FORMAT_MACROS" } } sourceSets { main { // let gradle pack the shared library into apk //jniLibs.srcDirs = ['../wolfssl/dist'] //jniLibs.srcDirs = ['../dist/gperf/lib'] } } productFlavors { demo { // different build settings externalNativeBuild { // ... // targets "native-lib-demo" } } paid { externalNativeBuild { // .. // targets "native-lib-paid" } } // in the future, ndk.abiFilter might also work // arm7 { // ndk { // abiFilter 'armeabi-v7a' // } // } // arm8 { // ndk { // abiFilters 'arm64-v8a' // } // } // arm { // ndk { // abiFilter 'armeabi' // } // } // x86 { // ndk { // abiFilter 'x86' // } // } // x86_64 { // ndk { // abiFilter 'x86_64' // } // } // mips { // ndk { // abiFilters 'mips', 'mips64' // } // } // all { // ndk { // abiFilters 'mips', 'mips64', 'x86', 'x86_64' // } // } } // productFlavors } // android dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:25.2.0' testCompile 'junit:junit:4.12' }