apply plugin: 'com.android.application' android { compileSdkVersion = rootProject.ext.sdkVersion defaultConfig { ndk { abiFilters rootProject.ext.archs.split(",") } } buildTypes { release debug { jniDebuggable true } } } task buildGo(type: Exec) { commandLine '../bash_script/build_go.sh', rootProject.ext.archs, rootProject.ext.sdkVersion } task prepareToolchain(type: Exec) { commandLine '../bash_script/build_toolchain.sh', rootProject.ext.archs, rootProject.ext.sdkVersion } task cleanToolchain(type: Exec) { commandLine 'rm', '-r', 'build_go/toolchain' } task cleanOutput(type: Exec) { commandLine 'rm', '-r', 'build_go/output' } afterEvaluate { buildGo.dependsOn prepareToolchain preBuild.dependsOn buildGo clean.dependsOn cleanOutput }