creek

The AI Image Editor of 2030

android/app/build.gradle.kts (3089B)


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