plugins { id 'com.android.library' } android { def androidConfig = rootProject.ext.android compileSdkVersion androidConfig.compile_sdk_version buildToolsVersion androidConfig.build_tools_version defaultConfig { minSdk androidConfig.min_sdk_version targetSdk androidConfig.target_sdk_version versionCode androidConfig.version_code versionName androidConfig.version_name multiDexEnabled true //解决64k 分包限制 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' ndk { // 只接入 armeabi-v7a 和 x86 架构 abiFilters 'armeabi-v7a', 'arm64-v8a' } externalNativeBuild { cmake { cppFlags "-std=c++11" } } } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" version "3.10.2" } } ndkVersion = '20.0.5594570' buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } // Android Gradle 插件 4.0,下述配置不再是必需的,并且会导致构建失败。外部原生 build 现在会自动打包这些库,因此使用 jniLibs 明确打包库会导致重复。 // sourceSets { // main { // jniLibs.srcDirs = ['libs'] // } // } } dependencies { api fileTree(dir: 'libs', include: ['*.jar']) rootProject.ext.dependencies_required.each { k, v -> implementation v } testImplementation rootProject.ext.dependencies_testImplementation.junit rootProject.ext.dependencies_androidTestImplementation.each { k, v -> androidTestImplementation v } implementation project(path: ':lib:common') }