Change way to set app name and application id for android app

This commit is contained in:
M 2022-01-11 19:23:59 +02:00
parent 82c6c3ca8a
commit da170118a8
4 changed files with 22 additions and 2 deletions

1
.gitignore vendored
View file

@ -129,3 +129,4 @@ assets/images/app_logo.png
/pubspec.yaml /pubspec.yaml
/pubspec.lock /pubspec.lock
/android/app.properties

View file

@ -30,6 +30,12 @@ if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} }
def appProperties = new Properties()
def appPropertiesFile = rootProject.file('app.properties')
if (appPropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(appPropertiesFile))
}
android { android {
compileSdkVersion 29 compileSdkVersion 29
@ -38,13 +44,13 @@ android {
} }
defaultConfig { defaultConfig {
applicationId System.getenv('APP_ANDROID_ID') applicationId appProperties['id']
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [APP_NAME: System.getenv('APP_ANDROID_NAME')] manifestPlaceholders = [APP_NAME: appProperties['name']]
externalNativeBuild { externalNativeBuild {
cmake { cmake {

View file

@ -5,6 +5,7 @@ if [ -z "$APP_ANDROID_TYPE" ]; then
exit 1 exit 1
fi fi
./app_properties.sh
./app_icon.sh ./app_icon.sh
CONFIG_ARGS="" CONFIG_ARGS=""

View file

@ -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