Files
MeshPort/apps/meshport_lab/android/app/build.gradle.kts
T

83 lines
3.0 KiB
Kotlin

import java.util.Properties
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")
}
val standalone = System.getenv("MESHPORT_ANDROID_STANDALONE") == "1"
val standaloneSigning = Properties().apply {
if (standalone) {
val path = requireNotNull(System.getenv("MESHPORT_ANDROID_SIGNING_PROPERTIES")) {
"Use scripts/package-lab-android.sh --standalone to prepare signing"
}
file(path).inputStream().use { load(it) }
}
}
android {
buildFeatures { buildConfig = true }
namespace = "com.example.meshport_lab"
compileSdk = flutter.compileSdkVersion
ndkVersion = "28.2.13676358"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = if (standalone) "com.meshport.client.standalone" else "com.example.meshport_lab"
manifestPlaceholders["meshportAppLabel"] = if (standalone) "MeshPort 独立版" else "MeshPort"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 26
ndk { abiFilters += listOf("arm64-v8a") }
externalNativeBuild { cmake {
arguments += "-DANDROID_STL=c++_shared"
abiFilters += "arm64-v8a"
} }
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
signingConfigs {
if (standalone) {
create("standalone") {
storeFile = file(standaloneSigning.getProperty("storeFile"))
storePassword = standaloneSigning.getProperty("storePassword")
keyAlias = standaloneSigning.getProperty("keyAlias")
keyPassword = standaloneSigning.getProperty("keyPassword")
}
}
}
buildTypes {
debug { ndk { abiFilters.clear(); abiFilters += "arm64-v8a" } }
release {
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
// 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(if (standalone) "standalone" else "debug")
}
}
externalNativeBuild { cmake { path = file("src/main/cpp/CMakeLists.txt"); version = "3.22.1" } }
}
flutter {
source = "../.."
}
// Offline QR decoding and an in-app camera capture Activity.
dependencies {
implementation("com.journeyapps:zxing-android-embedded:4.3.0")
testImplementation("junit:junit:4.13.2")
}