diff --git a/.gitignore b/.gitignore index d47d3cbe6..280a473ec 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,4 @@ assets/images/app_logo.png /pubspec.yaml /pubspec.lock +/android/app.properties diff --git a/android/app/build.gradle b/android/app/build.gradle index 4a2948cb4..474074590 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -30,6 +30,12 @@ if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } +def appProperties = new Properties() +def appPropertiesFile = rootProject.file('app.properties') +if (appPropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(appPropertiesFile)) +} + android { compileSdkVersion 29 @@ -38,13 +44,13 @@ android { } defaultConfig { - applicationId System.getenv('APP_ANDROID_ID') + applicationId appProperties['id'] minSdkVersion 21 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - manifestPlaceholders = [APP_NAME: System.getenv('APP_ANDROID_NAME')] + manifestPlaceholders = [APP_NAME: appProperties['name']] externalNativeBuild { cmake { diff --git a/scripts/android/app_config.sh b/scripts/android/app_config.sh index a7763d8bd..c72f8e8c0 100755 --- a/scripts/android/app_config.sh +++ b/scripts/android/app_config.sh @@ -5,6 +5,7 @@ if [ -z "$APP_ANDROID_TYPE" ]; then exit 1 fi +./app_properties.sh ./app_icon.sh CONFIG_ARGS="" diff --git a/scripts/android/app_properties.sh b/scripts/android/app_properties.sh new file mode 100755 index 000000000..9c908533e --- /dev/null +++ b/scripts/android/app_properties.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +APP_PROPERTIES_PATH=./../../android/app.properties + +if [ -z "$APP_ANDROID_TYPE" ]; then + echo "Please set APP_ANDROID_TYPE" + exit 1 +fi + +touch $APP_PROPERTIES_PATH + +echo -e "id=${APP_ANDROID_BUNDLE_ID}\nname=${APP_ANDROID_NAME}" > $APP_PROPERTIES_PATH \ No newline at end of file