yijianlianUI/app/build.gradle.kts

203 lines
6.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import java.net.URL
import java.nio.file.Files
import java.nio.file.StandardCopyOption
plugins {
kotlin("android")
kotlin("kapt")
id("com.android.application")
id("kotlin-parcelize")
id("com.google.devtools.ksp")
id("kotlinx-serialization")
}
dependencies {
implementation(fileTree(mapOf("dir" to "src/main/libs", "include" to listOf("*.aar"))))
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
implementation(files("src\\main\\libs\\Baidu_ocpc_action_2_7_2.aar"))
ksp(libs.kaidl.compiler)
ksp(libs.androidx.room.compiler)
implementation(libs.kotlin.coroutine)
implementation(libs.kotlin.serialization.json)
implementation(libs.androidx.core)
implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.ktx)
implementation(libs.kaidl.runtime)
implementation(libs.rikkax.multiprocess)
val commonAar = file("libs/common.aar")
val coreAar = file("libs/core.aar")
val hideapiAar = file("libs/hideapi.aar")
val serviceAar = file("libs/service.aar")
val oss = file("libs/oss-android-sdk-2.9.19.aar")
if (oss.exists()) {
implementation(files(oss))
} else {
println("oss.aar does not exist")
}
if (commonAar.exists()) {
implementation(files(commonAar))
} else {
println("common.aar does not exist")
}
if (coreAar.exists()) {
implementation(files(coreAar))
} else {
println("core.aar does not exist")
}
if (hideapiAar.exists()) {
implementation(files(hideapiAar))
} else {
println("hideapi.aar does not exist")
}
if (serviceAar.exists()) {
implementation(files(serviceAar))
} else {
println("service.aar does not exist")
}
implementation(libs.kotlin.coroutine)
implementation(libs.androidx.core)
// implementation(libs.androidx.activity)
// implementation(libs.androidx.fragment)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.coordinator)
implementation(libs.androidx.recyclerview)
implementation(libs.google.material)
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
// https://mvnrepository.com/artifact/com.tencent/mmkv-static
implementation("com.tencent:mmkv-static:1.2.10")
implementation ("com.jakewharton:process-phoenix:3.0.0")
implementation("com.afollestad.material-dialogs:core:3.2.1")
//Retrofit 网络请求库
api("com.squareup.retrofit2:retrofit:2.9.0")
api("com.squareup.retrofit2:converter-gson:2.9.0")
api("com.squareup.retrofit2:converter-scalars:2.9.0")
api("com.orhanobut:logger:2.2.0")
api("com.google.code.gson:gson:2.10.1")
api(platform("com.squareup.okhttp3:okhttp-bom:4.10.0"))
// define any required OkHttp artifacts without version
api("com.squareup.okhttp3:okhttp")
api("com.squareup.okhttp3:logging-interceptor")
//// https://mvnrepository.com/artifact/com.google.code.gson/gson
// api("com.google.code.gson:gson:2.10.1")
api("org.yaml:snakeyaml:1.29")
// https://mvnrepository.com/artifact/com.alipay.sdk/alipaysdk-android
implementation("com.alipay.sdk:alipaysdk-android:15.8.17")
implementation("com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4")
implementation("com.github.bumptech.glide:glide:4.13.2")
implementation("com.github.gzu-liyujiang:Android_CN_OAID:4.2.8") {
exclude("com.hihonor.mcs", "ads-identifier")
exclude("com.huawei.hms", "ads-identifier")
}
// 华为的最新版本广告标识服务SDK参阅 https://developer.huawei.com/consumer/cn/doc/HMSCore-Guides/identifier-service-version-change-history-0000001050066927
api ("com.huawei.hms:ads-identifier:3.4.62.300")
// // 荣耀的最新版本广告标识服务SDK参阅 https://developer.hihonor.com/cn/kitdoc?kitId=11030&navigation=guides&docId=intergrate.md
api ("com.hihonor.mcs:ads-identifier:1.0.2.301")
//stripe 支付
implementation("com.android.installreferrer:installreferrer:2.2")// 使用最新版本
implementation("io.github.youth5201314:banner:2.2.3")
}
tasks.getByName("clean", type = Delete::class) {
delete(file("release"))
}
val geoFilesDownloadDir = "src/main/assets"
task("downloadGeoFiles") {
val geoFilesUrls = mapOf(
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb" to "geoip.metadb",
"https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat" to "geosite.dat",
// "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb" to "country.mmdb",
)
doLast {
geoFilesUrls.forEach { (downloadUrl, outputFileName) ->
val url = URL(downloadUrl)
val outputPath = file("$geoFilesDownloadDir/$outputFileName")
if (!outputPath.exists()) {
outputPath.parentFile.mkdirs()
url.openStream().use { input ->
Files.copy(input, outputPath.toPath(), StandardCopyOption.REPLACE_EXISTING)
println("$outputFileName downloaded to $outputPath")
}
} else {
println("$outputFileName exists $outputPath")
//如果存在就从该文件复制
}
}
}
}
afterEvaluate {
val downloadGeoFilesTask = tasks["downloadGeoFiles"]
tasks.forEach {
if (it.name.startsWith("assemble")) {
it.dependsOn(downloadGeoFilesTask)
}
}
}
tasks.getByName("clean", type = Delete::class) {
delete(file(geoFilesDownloadDir + "/geoip.metadb"))
delete(file(geoFilesDownloadDir + "/geosite.dat"))
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
android {
kotlinOptions {
jvmTarget = "17" // 或者改为 "1.8"
}
defaultConfig {
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters.add("arm64-v8a")
abiFilters.add("armeabi-v7a")
}
}
// sourceSets.all {
// jniLibs.srcDir("src/main/jniLibs")
// }
sourceSets.all {
jniLibs.srcDir("src/main/jniLibs")
}
buildTypes {
getByName("release") {
signingConfig = signingConfigs.getByName("release")
}
getByName("debug") {
signingConfig = signingConfigs.getByName("release")
}
}
buildFeatures {
buildConfig = true
}
}
repositories {
flatDir {
dirs("src/main/libs")
}
mavenCentral()
}