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" id("com.google.gms.google-services") } // Load keystore properties from key.properties file def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } android { // Define the namespace for your Android application namespace = "com.marcoonfieldwork.aiot" // Set the compile SDK version based on Flutter's configuration compileSdk = flutter.compileSdkVersion // Set the NDK version based on Flutter's configuration ndkVersion = flutter.ndkVersion // Configure Java compatibility options compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 // ✅ Enable core library desugaring for Java 8+ APIs coreLibraryDesugaringEnabled true } // Configure Kotlin options for JVM target kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8 } // Default configuration for your application defaultConfig { // Specify your unique Application ID. This identifies your app on Google Play. applicationId = "com.marcoonfieldwork.aiot" // Set minimum and target SDK versions based on Flutter's configuration minSdkVersion = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion // Set version code and name based on Flutter's configuration (from pubspec.yaml) versionCode = flutter.versionCode versionName = flutter.versionName } // Define signing configurations for different build types signingConfigs { release { if (keystorePropertiesFile.exists()) { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] } } } // Define different build types (e.g., debug, release) buildTypes { release { if (keystorePropertiesFile.exists()) { signingConfig signingConfigs.release } minifyEnabled true shrinkResources true } } } // Configure Flutter specific settings, pointing to the root of your Flutter project flutter { source = "../.." } // ✅ Add required dependencies for desugaring dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.4' }