Files
app/android/app/build.gradle.kts
T
gongyun b02daf1448 主要合入内容:
- 文件管理器分页加载、排序偏好、桌面表头排序、移动端排序菜单、Ctrl/Cmd+F搜索、Esc 关闭搜索、鼠标右滑返回上级。
- 移动端同步状态页、同步统计卡片、同步任务/累计统计事件、同步页布局更新。
- Android 相册同步默认路径改为 DCIM/Camera,下载路径改用 external_path。
- Rust sync-core 更新:Android 日志依赖、AlbumUpload/AlbumDownload、MirrorWcf 统计修复、Linux FUSE镜像挂载与读写同步支持。

- 依赖更新:external_path、fl_chart、pdfrx 升级,并修了 pdfrx 新版本的deprecated API。
- 新增文件包括:sort_options.dart、sync_page_android.dart、sync_stats_card.dart、platform/fuse.rs、sync_engine/fuse.rs。
2026-06-04 07:11:43 +08:00

137 lines
4.4 KiB
Kotlin

plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
import java.util.Properties
import java.io.FileInputStream
// 1. Create a Properties object
val localProperties = Properties()
val localPropertiesFile = rootProject.file("local.properties")
// 2. Load the file if it exists
if (localPropertiesFile.exists()) {
localProperties.load(FileInputStream(localPropertiesFile))
}
// 3. Helper function to read the value as an Int
fun getLocalProperty(key: String, defaultValue: Int): Int {
val value = localProperties.getProperty(key)
return value?.toIntOrNull() ?: defaultValue
}
// 1. 加载 key.properties
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
val releaseStoreFile = keystoreProperties.getProperty("storeFile")?.let { rootProject.file(it) }
val hasReleaseSigning = listOf(
"keyAlias",
"keyPassword",
"storePassword",
).all { !keystoreProperties.getProperty(it).isNullOrBlank() } &&
releaseStoreFile?.exists() == true
android {
namespace = "com.limo.cloudreve4_flutter"
compileSdk = getLocalProperty("flutter.compileSdkVersion", 36)
ndkVersion = flutter.ndkVersion
// 2. 配置签名选项
signingConfigs {
create("release") {
if (hasReleaseSigning) {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storeFile = releaseStoreFile
storePassword = keystoreProperties.getProperty("storePassword")
}
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
sourceSets {
getByName("main") {
jniLibs.srcDirs("src/main/jniLibs")
}
}
defaultConfig {
applicationId = "com.limo.cloudreve4_flutter"
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = getLocalProperty("flutter.minSdkVersion", 24)
targetSdk = getLocalProperty("flutter.targetSdkVersion", 35)
versionCode = flutter.versionCode
versionName = flutter.versionName
ndk {
// abiFilters.addAll(listOf("arm64-v8a", "armeabi-v7a"))
}
}
splits {
abi {
isEnable = true
reset()
include("armeabi-v7a", "arm64-v8a", "x86_64")
// include("armeabi-v7a", "arm64-v8a")
isUniversalApk = true
}
}
packaging {
resources {
// 如果遇到重复的 .so 文件,优先取第一个
pickFirst("lib/**/libmpv.so")
pickFirst("lib/**/libmediakitandroidhelper.so")
}
}
buildTypes {
release {
// 1. 将原来的 getByName("debug") 替换为 getByName("release")
signingConfig = signingConfigs.getByName(if (hasReleaseSigning) "release" else "debug")
// 2. 建议同时开启混淆,这能大幅减小网盘应用的体积并保护代码
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
applicationVariants.all {
val variant = this
outputs.all {
val output = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl
val appName = "cloudreve4_flutter"
val versionName = variant.versionName
val versionCode = variant.versionCode
val type = variant.name // release 或 debug
val abi = output.getFilter(com.android.build.OutputFile.ABI) ?: "universal"
output.outputFileName = "${appName}_v${versionName}_${versionCode}_${abi}_release.apk"
}
}
}
flutter {
source = "../.."
}