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")) // implementation(files("src\\main\\libs\\OpenInstall.jar")) // implementation("com.google.firebase:firebase-crashlytics-buildtools:3.0.2") // implementation(files("src/main/libs/openinstall.jar")) // compileOnly(project(":hideapi")) // implementation(project(":core")) // implementation(project(":service")) // implementation(project(":common")) 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") // https://mvnrepository.com/artifact/com.journeyapps/zxing-android-embedded // implementation("com.journeyapps:zxing-android-embedded:3.6.0") // https://mvnrepository.com/artifact/com.google.zxing/core // implementation("com.google.zxing:core:3.5.3") implementation("com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4") // https://mvnrepository.com/artifact/com.airbnb.android/lottie implementation("com.airbnb.android:lottie:5.2.0") // https://mvnrepository.com/artifact/com.github.bumptech.glide/glide implementation("com.github.bumptech.glide:glide:4.13.2") // implementation("com.luozm.captcha:captcha:1.1.2") // implementation("com.aliyun.dpa:oss-android-sdk:2.9.19") // implementation ("com.hihonor.mcs:ads-identifier:1.0.3.301") 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.stripe:stripe-android:21.4.2")// 使用最新版本 implementation("com.github.getActivity:XXPermissions:20.0") implementation("com.android.installreferrer:installreferrer:2.2")// 使用最新版本 implementation("io.github.youth5201314:banner:2.2.3") implementation("com.github.zhpanvip:viewpagerindicator:1.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 { 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() }