From d6fdd7cf09c7554725c3ab3af18f4c013181fbff Mon Sep 17 00:00:00 2001 From: Stefan Smudja Date: Tue, 20 Aug 2024 10:35:50 +0200 Subject: [PATCH] Use of local environment variables instead of hard coding them in the source code of the project --- .gitignore | 1 + app/build.gradle.kts | 11 +++++++++++ app/src/main/AndroidManifest.xml | 3 +-- gradle.properties | 4 +--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d786f76..944d66e 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ .externalNativeBuild .cxx local.properties +env.properties keystore app/release \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 767c2bd..f1a8288 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,8 +1,17 @@ +import java.io.FileInputStream +import java.util.Properties + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") } +var props = Properties() +var propsFile = rootProject.file("env.properties") +if (propsFile.exists()) { + props.load(FileInputStream(propsFile)) +} + android { namespace = "com.lilstiffy.mockgps" compileSdk = 34 @@ -14,6 +23,8 @@ android { versionCode = 5 versionName = "1.0.4" + manifestPlaceholders["API_KEY"] = props.getProperty("MAPS_API_KEY") + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7619714..b4af94d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -36,10 +36,9 @@ - + android:value="${API_KEY}" />