File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -2,20 +2,32 @@ apply plugin: 'com.android.application'
22apply plugin : ' kotlin-android'
33apply plugin : ' kotlin-android-extensions'
44
5+ // [START maps_android_api_key_security_manifest_placeholder]
56android {
6- compileSdkVersion 29
7+ // [START_EXCLUDE silent]
8+ compileSdkVersion 30
79 buildToolsVersion " 29.0.3"
8-
10+ // [END_EXCLUDE]
911 defaultConfig {
12+ // [START_EXCLUDE]
1013 applicationId " com.google.maps.example"
1114 minSdkVersion 21
12- targetSdkVersion 29
15+ targetSdkVersion 30
1316 versionCode 1
1417 versionName " 1.0"
15-
1618 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
17- }
19+ // [END_EXCLUDE]
20+ // Set the properties within `local.properties` into a `Properties` class so that values
21+ // within `local.properties` (e.g. Maps API key) are accessible in this file.
22+ Properties properties = new Properties ()
23+ if (rootProject. file(" local.properties" ). exists()) {
24+ properties. load(rootProject. file(" local.properties" ). newDataInputStream())
25+ }
1826
27+ // Inject the Maps API key into the manifest
28+ manifestPlaceholders = [ mapsApiKey : properties. getProperty(" MAPS_API_KEY" , " " ) ]
29+ }
30+ // [START_EXCLUDE silent]
1931 buildTypes {
2032 release {
2133 minifyEnabled false
@@ -41,7 +53,9 @@ android {
4153 sourceCompatibility JavaVersion . VERSION_1_8
4254 targetCompatibility JavaVersion . VERSION_1_8
4355 }
56+ // [END_EXCLUDE]
4457}
58+ // [END maps_android_api_key_security_manifest_placeholder]
4559
4660dependencies {
4761 implementation fileTree(dir : " libs" , include : [" *.jar" ])
Original file line number Diff line number Diff line change 2323 android : label =" @string/app_name"
2424 android : roundIcon =" @mipmap/ic_launcher_round"
2525 android : supportsRtl =" true"
26- android : theme =" @style/AppTheme" />
26+ android : theme =" @style/AppTheme" >
27+
28+ <!-- [START maps_android_api_key_security_manifest_metadata] -->
29+ <meta-data
30+ android : name =" com.google.android.geo.API_KEY"
31+ android : value =" ${mapsApiKey}" />
32+ <!-- [END maps_android_api_key_security_manifest_metadata] -->
33+ </application >
2734
2835</manifest >
You can’t perform that action at this time.
0 commit comments