jni作为lib使用,优化编译

This commit is contained in:
2025-04-10 18:54:02 +08:00
parent ab69c535e4
commit 7007425199
26 changed files with 164 additions and 28 deletions

51
ttutils/build.gradle Normal file
View File

@@ -0,0 +1,51 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 34
// buildToolsVersion "34.0.0"
defaultConfig {
minSdkVersion 24
targetSdkVersion 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
ndk {
moduleName "ttutils"
//armeabi not supported for platform
//1.降低NDK版本至r16b以下。
//2.删除不再受支持的cpu架构相关配置。
// build.gradle中移除armeabi mips等
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
// 还可以添加 'armeabi', 'x86', 'x86_64', 'mips', 'mips64'
}
}
externalNativeBuild {
cmake {
path file('CMakeLists.txt')
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}