apply plugin: 'com.android.application' android { compileSdkVersion 28 // a default can be used, but it is good practice to explicitly select build tools buildToolsVersion '28.0.3' defaultConfig { applicationId 'io.malloc.ccc' minSdkVersion 23 targetSdkVersion 28 versionCode 1 versionName '1.0' externalNativeBuild { cmake { arguments '-DANDROID_PLATFORM=android-23', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static' } } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets { main { // let gradle pack the shared library into apk jniLibs.srcDirs = ['libs/wolfssl-jni'] } } externalNativeBuild { cmake { path 'CMakeLists.txt' } } } // Copies files to the dist/ folder, adds a timestamp // instead of using a bash script I ventured out to try this file copy in Groovy (Gradle) // ...and yay, I was successful =) task copyLibs(type: Copy) { def thisDate = new Date().format('yyyyMMdd_HHmmssSSS') from('build/intermediates/cmake/debug/obj/') { include '**/*.so' into 'debug' } from('build/intermediates/cmake/release/obj/') { include '**/*.so' into 'release' } into "dist/wolfssl-jni_${thisDate}/" } dependencies { testImplementation 'junit:junit:4.12' } // tasks.whenTaskAdded { task -> // if (task.name == 'externalNativeBuildRelease') { // task.dependsOn ":gen-libs:externalNativeBuildRelease" // } else if (task.name == 'externalNativeBuildDebug') { // task.dependsOn ":gen-libs:externalNativeBuildDebug" // } // }