74 lines
2.6 KiB
Groovy
74 lines
2.6 KiB
Groovy
plugins {
|
|
id 'com.android.library' // 替换 application 插件
|
|
id 'maven-publish' // 添加发布插件
|
|
}
|
|
|
|
android {
|
|
namespace 'com.tfq.libraryad'
|
|
compileSdkVersion 36
|
|
|
|
defaultConfig {
|
|
minSdkVersion 24
|
|
targetSdkVersion 36
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
// minifyEnabled true // 启用代码混淆
|
|
// shrinkResources true // 移除未使用资源(需配合混淆)
|
|
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' //激进优化(可能需额外规则适配)
|
|
}
|
|
}
|
|
|
|
// 添加 extractNativeLibs 配置
|
|
packagingOptions {
|
|
jniLibs {
|
|
useLegacyPackaging = true
|
|
pickFirsts += '**/*.so'
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
|
// implementation fileTree(include: ['*.aar'], dir: 'libs') // 强制打包AAR
|
|
// compileOnly fileTree(include: ['*.aar', '*.jar'], dir: 'libs')// 仅编译需要的JAR
|
|
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'
|
|
|
|
//沉浸式
|
|
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.2'
|
|
|
|
if (project.hasProperty('useLocal') && useLocal.toBoolean()){
|
|
//本地测试使用这个
|
|
compileOnly fileTree(dir: '../LibraryAdLib/libs', include: ['*.aar'])
|
|
} else {
|
|
//线上使用这个,因为是线上库
|
|
//假如使用这个的话,需要先将LibraryAdLib进行publish后再同步项目,更新下来
|
|
implementation "com.chuangketie.jk:lib_ad_GDTSDK.unionNormal:$rootProject.maven_version.version"
|
|
implementation "com.chuangketie.jk:lib_ad_mediation_gdt_adapter:$rootProject.maven_version.version"
|
|
implementation "com.chuangketie.jk:lib_ad_open_ad_sdk:$rootProject.maven_version.version"
|
|
// compileOnly fileTree(dir: '../LibraryAdLib/libs', include: ['*.aar'])
|
|
}
|
|
}
|
|
|
|
afterEvaluate {
|
|
publishing {
|
|
publications {
|
|
release(MavenPublication) {
|
|
groupId = 'com.chuangketie.jk' // 自定义组织标识
|
|
artifactId = 'lib_ad' // 库名称
|
|
version = rootProject.maven_version.version //版本号
|
|
artifact("$buildDir/outputs/aar/${project.name}-release.aar")// 指定 AAR 文件路径
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url = "file://${projectDir.parent}/maven" // 指向本地目录
|
|
}
|
|
}
|
|
}
|
|
} |