Files
cutdex/android/app/build.gradle.kts
T
lingjhf 64a3a5b547
Gitea CI / Check code and tests (pull_request) Successful in 11m6s
Gitea CI / Build Android APK (pull_request) Successful in 5m15s
Gitea CI / Build Windows x64 app (pull_request) Successful in 2m41s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m2s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 51s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
fix(android): wire exact preview startup and device benchmarks
2026-10-08 01:37:58 +08:00

101 lines
3.9 KiB
Kotlin

plugins {
id("com.android.application")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
// Match native libraries to Flutter's requested targets; the media runtime is 64-bit only.
val supportedAndroidAbis = mapOf(
"android-arm64" to "arm64-v8a",
"android-x64" to "x86_64",
)
val requestedAndroidPlatforms = (findProperty("target-platform") as? String)
?.split(",") ?: supportedAndroidAbis.keys.toList()
val enabledAndroidAbis = requestedAndroidPlatforms.mapNotNull(supportedAndroidAbis::get)
check(enabledAndroidAbis.isNotEmpty()) {
"Cutdex requires Android ARM64 or x86_64. Use --target-platform android-arm64,android-x64."
}
android {
namespace = "com.example.cutdex"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
buildFeatures {
resValues = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.example.cutdex"
manifestPlaceholders["cutdexPreviewReverseCacheMiB"] = "0"
manifestPlaceholders["cutdexNativeSurfacePreview"] = "false"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 31
targetSdk = flutter.targetSdkVersion
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION
// is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions)
// You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
// flag during build.
versionCode = flutter.versionCode
versionName = flutter.versionName
}
flavorDimensions += "environment"
productFlavors {
create("development") {
dimension = "environment"
applicationIdSuffix = ".dev"
// Device validation can coexist with an app signed on another machine.
val validationId = providers.gradleProperty("cutdexValidationApplicationId")
.orElse(providers.environmentVariable("CUTDEX_VALIDATION_APPLICATION_ID")).orNull
if (validationId != null) applicationId = validationId
resValue("string", "app_name", if (validationId == null) "Cutdex Dev" else "Cutdex Decoder Test")
manifestPlaceholders["cutdexPreviewReverseCacheMiB"] = providers
.gradleProperty("cutdexPreviewReverseCacheMiB")
.orElse(providers.environmentVariable("CUTDEX_PREVIEW_REVERSE_CACHE_MIB")).getOrElse("0")
manifestPlaceholders["cutdexNativeSurfacePreview"] = providers
.gradleProperty("cutdexNativeSurfacePreview")
.orElse(providers.environmentVariable("CUTDEX_NATIVE_SURFACE_PREVIEW")).getOrElse("false")
}
create("production") {
dimension = "environment"
resValue("string", "app_name", "Cutdex")
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
if (splits.abi.isEnable) {
splits.abi.reset()
splits.abi.include(*enabledAndroidAbis.toTypedArray())
} else {
defaultConfig.ndk {
abiFilters.clear()
abiFilters += enabledAndroidAbis
}
}
}
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
flutter {
source = "../.."
}