78 lines
2.8 KiB
Groovy
78 lines
2.8 KiB
Groovy
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"
|
|
}
|
|
|
|
// 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.marco.aiotstage"
|
|
// 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
|
|
}
|
|
|
|
// 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.marco.aiotstage"
|
|
// Set minimum and target SDK versions based on Flutter's configuration
|
|
minSdk = 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 {
|
|
// Reference the key alias from key.properties
|
|
keyAlias keystoreProperties['keyAlias']
|
|
// Reference the key password from key.properties
|
|
keyPassword keystoreProperties['keyPassword']
|
|
// Reference the keystore file path from key.properties
|
|
storeFile file(keystoreProperties['storeFile'])
|
|
// Reference the keystore password from key.properties
|
|
storePassword keystoreProperties['storePassword']
|
|
}
|
|
}
|
|
|
|
// Define different build types (e.g., debug, release)
|
|
buildTypes {
|
|
release {
|
|
// Apply the 'release' signing configuration defined above to the release build
|
|
signingConfig signingConfigs.release
|
|
// Enable code minification to reduce app size
|
|
minifyEnabled true
|
|
// Enable resource shrinking to remove unused resources
|
|
shrinkResources true
|
|
// Other release specific configurations can be added here, e.g., ProGuard rules
|
|
}
|
|
}
|
|
}
|
|
|
|
// Configure Flutter specific settings, pointing to the root of your Flutter project
|
|
flutter {
|
|
source = "../.."
|
|
}
|