2025-06-30 13:49:41 +08:00
|
|
|
plugins {
|
|
|
|
|
id 'com.android.library' // 替换 application 插件
|
|
|
|
|
id 'maven-publish' // 添加发布插件
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
android {
|
|
|
|
|
namespace 'com.tfq.libraryad'
|
2025-07-09 16:02:54 +08:00
|
|
|
compileSdkVersion 36
|
2025-06-30 13:49:41 +08:00
|
|
|
|
|
|
|
|
defaultConfig {
|
2025-07-06 15:19:59 +08:00
|
|
|
minSdkVersion 24
|
2025-07-09 16:02:54 +08:00
|
|
|
targetSdkVersion 36
|
2025-06-30 13:49:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
|
release {
|
2025-07-30 08:40:25 +08:00
|
|
|
minifyEnabled true // 启用代码混淆
|
|
|
|
|
// shrinkResources true // 移除未使用资源(需配合混淆)
|
|
|
|
|
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'//基础保守优化。
|
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'//激进优化(可能需额外规则适配)
|
2025-06-30 13:49:41 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
|
main {
|
|
|
|
|
jniLibs.srcDirs = ['libs']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-29 10:02:54 +08:00
|
|
|
// 添加 extractNativeLibs 配置
|
|
|
|
|
packagingOptions {
|
|
|
|
|
jniLibs {
|
|
|
|
|
useLegacyPackaging = true
|
|
|
|
|
pickFirsts += '**/*.so'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-29 17:49:40 +08:00
|
|
|
sourceSets {
|
|
|
|
|
main {
|
|
|
|
|
jniLibs.srcDirs = ['libs']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-30 13:49:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
|
flatDir {
|
|
|
|
|
dirs 'libs'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
compileOnly fileTree(include: ['*.aar', '*.jar'], dir: 'libs')
|
2025-07-29 17:49:40 +08:00
|
|
|
// implementation fileTree(include: ['*.aar','*.jar'], dir: 'libs')
|
2025-07-06 15:19:59 +08:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
|
|
|
implementation 'com.google.android.material:material:1.11.0'
|
|
|
|
|
testImplementation 'junit:junit:4.13.2'
|
|
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
2025-06-30 13:49:41 +08:00
|
|
|
|
|
|
|
|
//沉浸式
|
2025-07-29 10:02:54 +08:00
|
|
|
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
|
2025-06-30 13:49:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
afterEvaluate {
|
|
|
|
|
publishing {
|
|
|
|
|
publications {
|
|
|
|
|
release(MavenPublication) {
|
2025-07-09 16:02:54 +08:00
|
|
|
groupId = 'com.chuangketie.jk' // 自定义组织标识
|
|
|
|
|
artifactId = 'ad-lib' // 库名称
|
2025-07-29 10:02:54 +08:00
|
|
|
version = '1.0.1'
|
2025-06-30 13:49:41 +08:00
|
|
|
artifact("$buildDir/outputs/aar/${project.name}-release.aar")// 指定 AAR 文件路径
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
repositories {
|
|
|
|
|
maven {
|
|
|
|
|
url = "file://${projectDir.parent}/maven" // 指向本地目录
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-06 15:19:59 +08:00
|
|
|
}
|