build.gradle.kts (3089B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | import java.util.Properties import java.io.FileInputStream buildscript { repositories { google() mavenCentral() maven { url = uri("https://chaquo.com/maven") } } dependencies { classpath("com.android.tools.build:gradle:8.9.1") classpath("com.chaquo.python:gradle:15.0.1") } } plugins { id("com.android.application") id("kotlin-android") id("com.chaquo.python") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } // Load the key.properties file generated by CI (or local file) val keystoreProperties = Properties() val keystorePropertiesFile = rootProject.file("key.properties") if (keystorePropertiesFile.exists()) { keystoreProperties.load(FileInputStream(keystorePropertiesFile)) } android { namespace = "com.creek.ui" compileSdk = flutter.compileSdkVersion ndkVersion = "28.2.13676358" compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlin { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) } } defaultConfig { applicationId = "com.creek.ui" minSdk = 24 targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode versionName = flutter.versionName ndk { // On Apple silicon, you can omit x86_64. abiFilters += listOf("arm64-v8a", "x86_64") } } signingConfigs { create("release") { keyAlias = keystoreProperties["keyAlias"] as String? keyPassword = keystoreProperties["keyPassword"] as String? storeFile = keystoreProperties["storeFile"]?.let { file(it) } storePassword = keystoreProperties["storePassword"] as String? } } buildTypes { release { signingConfig = signingConfigs.getByName("release") isMinifyEnabled = true isShrinkResources = true proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } } chaquopy { defaultConfig { version = "3.8" val isWindows = System.getProperty("os.name").lowercase().contains("windows") val pythonFile = if (isWindows) file("../../python_env/Scripts/python.exe") else file("../../python_env/bin/python") if (pythonFile.exists()) { println("Using local python environment: ${pythonFile.absolutePath}") buildPython(pythonFile.absolutePath) } else { println("Local python env not found. Using system 'python' from PATH.") buildPython("python") } pip { install("pillow") install("numpy") install("opencv-contrib-python-headless") install("instaloader") install("scikit-learn") install("joblib") } } } flutter { source = "../.." } |