56 lines
1.5 KiB
Groovy
56 lines
1.5 KiB
Groovy
plugins {
|
|
id 'com.android.library'
|
|
}
|
|
|
|
def targetAbi = ""
|
|
if (!gradle.startParameter.taskNames.isEmpty()) {
|
|
if (gradle.startParameter.taskNames.size == 1) {
|
|
def targetTask = gradle.startParameter.taskNames[0].toLowerCase()
|
|
if (targetTask.contains("arm64")) {
|
|
targetAbi = "arm64"
|
|
} else if (targetTask.contains("arm")) {
|
|
targetAbi = "arm"
|
|
}
|
|
} else {
|
|
targetAbi = "~"
|
|
}
|
|
}
|
|
|
|
|
|
android {
|
|
compileSdkVersion 30
|
|
buildToolsVersion '30.0.3'
|
|
ndkVersion rootProject.ext.ndkVersion
|
|
|
|
defaultConfig {
|
|
minSdkVersion 16
|
|
targetSdkVersion 29
|
|
versionCode 1
|
|
versionName "1.0"
|
|
|
|
externalNativeBuild {
|
|
ndkBuild {
|
|
if (!targetAbi.isBlank()) {
|
|
if (targetAbi == "arm64") {
|
|
abiFilters 'arm64-v8a'
|
|
} else if (targetAbi == "arm") {
|
|
abiFilters 'armeabi-v7a'
|
|
} else {
|
|
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
|
}
|
|
} else {
|
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
}
|
|
|
|
arguments "NDK_APPLICATION_MK:=src/main/jni/Application.mk", "APP_PLATFORM:=android-21", "--jobs=${Runtime.getRuntime().availableProcessors()}"
|
|
}
|
|
}
|
|
}
|
|
|
|
externalNativeBuild {
|
|
ndkBuild {
|
|
path 'src/main/jni/Android.mk'
|
|
}
|
|
}
|
|
|
|
} |