Skip to content

Instantly share code, notes, and snippets.

@Alvtag
Created June 26, 2020 17:44
Show Gist options
  • Save Alvtag/9a1590acaa3e6aee823d5960153e5ea0 to your computer and use it in GitHub Desktop.
Save Alvtag/9a1590acaa3e6aee823d5960153e5ea0 to your computer and use it in GitHub Desktop.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('keystore.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.tribalscale.flutter.VeggieSeasons"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias System.getenv("BITRISEIO_ANDROID_KEYSTORE_ALIAS")
keyPassword System.getenv("BITRISEIO_ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
storeFile file(System.getenv("HOME") + "/git/android/app/release.keystore")
storePassword System.getenv("BITRISEIO_ANDROID_KEYSTORE_PASSWORD")
}
debug {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
// ALVTAG: Use this if you have multiple environments for your app.
// Sample Run Configuration for multiple build flavor:
// Data Entrypoint: /Users/alvinfong/ecomm_flutter/lib/main.dart
// Additional Arguments: --flavor=uat
// Build Flavor: uat
//
// flavorDimensions "environment"
// productFlavors {
// uat {
// dimension "environment"
// applicationIdSuffix ".uat"
// versionNameSuffix "-uat"
// }
// prod {
// dimension "environment"
// }
// }
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment