diff --git a/snippets/app/build.gradle b/snippets/app/build.gradle index 8f4bf00a..89389cbc 100644 --- a/snippets/app/build.gradle +++ b/snippets/app/build.gradle @@ -1,33 +1,23 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' +plugins { + id 'com.android.application' + id 'kotlin-android' + // [START maps_android_secrets_gradle_plugin] + id 'com.google.secrets_gradle_plugin' version '0.5' + // [END maps_android_secrets_gradle_plugin] +} -// [START maps_android_api_key_security_manifest_placeholder] android { - // [START_EXCLUDE silent] compileSdkVersion 30 buildToolsVersion "29.0.3" - // [END_EXCLUDE] defaultConfig { - // [START_EXCLUDE] applicationId "com.google.maps.example" minSdkVersion 21 targetSdkVersion 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - // [END_EXCLUDE] - // 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()) - } - - // Inject the Maps API key into the manifest - manifestPlaceholders = [ mapsApiKey : properties.getProperty("MAPS_API_KEY", "") ] } - // [START_EXCLUDE silent] + buildTypes { release { minifyEnabled false @@ -53,9 +43,7 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - // [END_EXCLUDE] } -// [END maps_android_api_key_security_manifest_placeholder] dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) @@ -72,4 +60,8 @@ dependencies { v3Implementation 'com.google.android.libraries.maps:maps:3.1.0-beta' testImplementation 'junit:junit:4.13.2' +} + +secrets { + defaultPropertiesFileName = 'local.defaults.properties' } \ No newline at end of file diff --git a/snippets/app/src/main/AndroidManifest.xml b/snippets/app/src/main/AndroidManifest.xml index d64a1b03..2af5b367 100644 --- a/snippets/app/src/main/AndroidManifest.xml +++ b/snippets/app/src/main/AndroidManifest.xml @@ -28,7 +28,7 @@ + android:value="${MAPS_API_KEY}" /> diff --git a/snippets/build.gradle b/snippets/build.gradle index 8f2638ee..9d55db30 100644 --- a/snippets/build.gradle +++ b/snippets/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" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong diff --git a/snippets/gradle/wrapper/gradle-wrapper.properties b/snippets/gradle/wrapper/gradle-wrapper.properties index 53d5c1be..042f77c0 100644 --- a/snippets/gradle/wrapper/gradle-wrapper.properties +++ b/snippets/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Aug 25 10:27:15 PDT 2020 +#Fri Feb 26 09:19:32 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-all.zip diff --git a/snippets/local.defaults.properties b/snippets/local.defaults.properties new file mode 100644 index 00000000..faf6aaed --- /dev/null +++ b/snippets/local.defaults.properties @@ -0,0 +1 @@ +MAPS_API_KEY=YOUR_API_KEY \ No newline at end of file