diff --git a/ApiDemos/java/app/build.gradle b/ApiDemos/java/app/build.gradle
index fc4aa965..98a8da48 100644
--- a/ApiDemos/java/app/build.gradle
+++ b/ApiDemos/java/app/build.gradle
@@ -1,16 +1,10 @@
import org.apache.tools.ant.filters.ConcatFilter
-apply plugin: 'com.android.application'
-apply plugin: 'project-report'
-
-// Set the properties within `local.properties` into a `Properties` class so
-// that values within `local.properties` (e.g. Maps API key) are accessible in
-// this file.
-Properties properties = new Properties()
-if (rootProject.file("local.properties").exists()) {
- properties.load(rootProject.file("local.properties").newDataInputStream())
+plugins {
+ id 'com.android.application'
+ id 'project-report'
+ id 'com.google.secrets_gradle_plugin' version '0.4'
}
-def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 30
@@ -22,19 +16,6 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true
-
- // Inject the Maps API key into the manifest
- manifestPlaceholders = [ mapsApiKey : mapsApiKey ]
-
- // Reading the Maps API key into a BuildConfig value. This is only
- // necessary so that the sample app can display a toast message if the
- // API key was not set, otherwise, this can be skipped.
- buildConfigField("String", "MAPS_API_KEY", "\"$mapsApiKey\"" )
-
- // To add your Maps API key to this project:
- // 1. Open the root project's local.properties file
- // 2. Add this line, where YOUR_API_KEY is your API key:
- // MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@@ -100,3 +81,11 @@ task generateV3Layout(type: Copy) {
line.replace('com.google.android.gms.maps', 'com.google.android.libraries.maps')
}
}
+
+secrets {
+ // To add your Maps API key to this project:
+ // 1. Open the root project's local.properties file
+ // 2. Add this line, where YOUR_API_KEY is your API key:
+ // MAPS_API_KEY=YOUR_API_KEY
+ defaultPropertiesFileName 'local.defaults.properties'
+}
diff --git a/ApiDemos/java/app/src/main/AndroidManifest.xml b/ApiDemos/java/app/src/main/AndroidManifest.xml
index e5cd8c3b..0a30ad9d 100644
--- a/ApiDemos/java/app/src/main/AndroidManifest.xml
+++ b/ApiDemos/java/app/src/main/AndroidManifest.xml
@@ -58,7 +58,7 @@
-->
+ android:value="${MAPS_API_KEY}" />
diff --git a/ApiDemos/java/build.gradle b/ApiDemos/java/build.gradle
index 6175513d..bb5db035 100644
--- a/ApiDemos/java/build.gradle
+++ b/ApiDemos/java/build.gradle
@@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.0.1'
+ classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/ApiDemos/java/gradle/wrapper/gradle-wrapper.properties b/ApiDemos/java/gradle/wrapper/gradle-wrapper.properties
index 97c63228..4c0b9b2f 100644
--- a/ApiDemos/java/gradle/wrapper/gradle-wrapper.properties
+++ b/ApiDemos/java/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Jul 27 14:56:43 PDT 2020
+#Wed Jan 27 10:05:54 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
diff --git a/ApiDemos/java/local.defaults.properties b/ApiDemos/java/local.defaults.properties
new file mode 100644
index 00000000..b4dc1ed7
--- /dev/null
+++ b/ApiDemos/java/local.defaults.properties
@@ -0,0 +1 @@
+MAPS_API_KEY=""
\ No newline at end of file
diff --git a/ApiDemos/kotlin/app/build.gradle b/ApiDemos/kotlin/app/build.gradle
index cbb0a95b..930e06d8 100644
--- a/ApiDemos/kotlin/app/build.gradle
+++ b/ApiDemos/kotlin/app/build.gradle
@@ -1,17 +1,11 @@
import org.apache.tools.ant.filters.ConcatFilter
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-
-// Set the properties within `local.properties` into a `Properties` class so
-// that values within `local.properties` (e.g. Maps API key) are accessible in
-// this file.
-Properties properties = new Properties()
-if (rootProject.file("local.properties").exists()) {
- properties.load(rootProject.file("local.properties").newDataInputStream())
+plugins {
+ id 'com.android.application'
+ id 'kotlin-android'
+ id 'kotlin-android-extensions'
+ id 'com.google.secrets_gradle_plugin' version '0.4'
}
-def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 30
@@ -23,19 +17,6 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
-
- // Inject the Maps API key into the manifest
- manifestPlaceholders = [ mapsApiKey : mapsApiKey ]
-
- // Reading the Maps API key into a BuildConfig value. This is only
- // necessary so that the sample app can display a toast message if the
- // API key was not set, otherwise, this can be skipped.
- buildConfigField("String", "MAPS_API_KEY", "\"$mapsApiKey\"" )
-
- // To add your Maps API key to this project:
- // 1. Open the root project's local.properties file
- // 2. Add this line, where YOUR_API_KEY is your API key:
- // MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@@ -110,3 +91,11 @@ task generateV3Layout(type: Copy) {
line.replace('com.google.android.gms.maps', 'com.google.android.libraries.maps')
}
}
+
+secrets {
+ // To add your Maps API key to this project:
+ // 1. Open the root project's local.properties file
+ // 2. Add this line, where YOUR_API_KEY is your API key:
+ // MAPS_API_KEY=YOUR_API_KEY
+ defaultPropertiesFileName 'local.defaults.properties'
+}
diff --git a/ApiDemos/kotlin/app/src/main/AndroidManifest.xml b/ApiDemos/kotlin/app/src/main/AndroidManifest.xml
index d0639b6c..22fb3697 100644
--- a/ApiDemos/kotlin/app/src/main/AndroidManifest.xml
+++ b/ApiDemos/kotlin/app/src/main/AndroidManifest.xml
@@ -49,7 +49,7 @@
-->
+ android:value="${MAPS_API_KEY}" />
\ No newline at end of file
diff --git a/ApiDemos/kotlin/local.defaults.properties b/ApiDemos/kotlin/local.defaults.properties
new file mode 100644
index 00000000..9e0d438a
--- /dev/null
+++ b/ApiDemos/kotlin/local.defaults.properties
@@ -0,0 +1 @@
+MAPS_API_KEY=""
diff --git a/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle b/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle
index 0426de3d..3dc616f7 100644
--- a/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle
+++ b/tutorials/java/CurrentPlaceDetailsOnMap/app/build.gradle
@@ -1,13 +1,7 @@
-apply plugin: 'com.android.application'
-
-// Set the properties within `local.properties` into a `Properties` class so
-// that values within `local.properties` (e.g. Maps API key) are accessible in
-// this file.
-Properties properties = new Properties()
-if (rootProject.file("local.properties").exists()) {
- properties.load(rootProject.file("local.properties").newDataInputStream())
+plugins {
+ id 'com.android.application'
+ id 'com.google.secrets_gradle_plugin' version '0.4'
}
-def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 30
@@ -19,15 +13,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
- // Read the API key from local.properties into R.string.maps_api_key
- resValue "string", "maps_api_key", mapsApiKey
-
- // To add your Maps API key to this project:
- // 1. Open the root project's local.properties file
- // 2. Add this line, where YOUR_API_KEY is your API key:
- // MAPS_API_KEY=YOUR_API_KEY
-
}
buildTypes {
debug {
@@ -50,3 +35,11 @@ dependencies {
implementation 'com.google.android.libraries.places:places:2.4.0'
testImplementation'junit:junit:4.12'
}
+
+secrets {
+ // To add your Maps API key to this project:
+ // 1. Open the root project's local.properties file
+ // 2. Add this line, where YOUR_API_KEY is your API key:
+ // MAPS_API_KEY=YOUR_API_KEY
+ defaultPropertiesFileName 'local.defaults.properties'
+}
diff --git a/tutorials/java/CurrentPlaceDetailsOnMap/app/src/main/AndroidManifest.xml b/tutorials/java/CurrentPlaceDetailsOnMap/app/src/main/AndroidManifest.xml
index 68906fce..e2b5ec79 100644
--- a/tutorials/java/CurrentPlaceDetailsOnMap/app/src/main/AndroidManifest.xml
+++ b/tutorials/java/CurrentPlaceDetailsOnMap/app/src/main/AndroidManifest.xml
@@ -35,7 +35,7 @@
-->
+ android:value="${MAPS_API_KEY}" />
+ android:value="${MAPS_API_KEY}" />
+ android:value="${MAPS_API_KEY}" />
+ android:value="${MAPS_API_KEY}" />
+ android:value="${MAPS_API_KEY}" />
+ android:value="${MAPS_API_KEY}" />