Files
flutter/android/app/build.gradle
Roland Geider b9229b0ea3 Add button to take pictures or load images from gallery
At the moment not functional and nothing is done with the data
2021-05-07 13:49:15 +02:00

102 lines
3.2 KiB
Groovy

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"
// Keys for the android play store
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('fastlane/envfiles/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
// Key for wger.de REST API
def wgerProperties = new Properties()
def localMapsPropertiesFile = rootProject.file('fastlane/envfiles/wger.properties')
if (localMapsPropertiesFile.exists()) {
project.logger.info('Load maps properties from local file')
localMapsPropertiesFile.withReader('UTF-8') { reader ->
wgerProperties.load(reader)
}
} else {
project.logger.info('Load maps properties from environment')
try {
wgerProperties['WGER_API_KEY'] = System.getenv('WGER_API_KEY')
} catch(NullPointerException e) {
project.logger.warn('Failed to load WGER_API_KEY from environment.', e)
}
}
def wgerApiKey = wgerProperties.getProperty('WGER_API_KEY')
if(wgerApiKey == null){
wgerApiKey = ""
project.logger.error('Wger Api Key not configured. Set it in `app/wger.properties` or in the environment variable `WGER_API_KEY`')
}
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "de.wger.flutter"
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
manifestPlaceholders = [WGER_API_KEY: wgerApiKey]
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}