finally use correct api key

This commit is contained in:
Remy Moll 2024-06-07 15:06:33 +02:00
parent 040e5c9f83
commit 40943c5c5b

View File

@ -3,17 +3,18 @@ plugins {
id "kotlin-android" id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin" id "dev.flutter.flutter-gradle-plugin"
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
// last is probably not needed
} }
def localPropertiesFile = rootProject.file('local.properties')
def localProperties = new Properties() def localProperties = new Properties()
def localPropertiesFile = rootProject.file('secrets.properties')
if (localPropertiesFile.exists()) { if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader -> localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader) localProperties.load(reader)
} }
} else { } else {
throw new GradleException("Secrets file secrets.properties not found") throw new GradleException("local.properties not found")
} }
def flutterVersionCode = localProperties.getProperty('flutter.versionCode') def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
@ -26,6 +27,20 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.0'
} }
def secretPropertiesFile = rootProject.file('secrets.properties')
def secretProperties = new Properties()
if (secretPropertiesFile.exists()) {
secretPropertiesFile.withReader('UTF-8') { reader ->
secretProperties.load(reader)
}
} else {
throw new GradleException("Secrets file secrets.properties not found")
}
android { android {
namespace "com.example.fast_network_navigation" namespace "com.example.fast_network_navigation"
compileSdk flutter.compileSdkVersion compileSdk flutter.compileSdkVersion
@ -56,8 +71,8 @@ android {
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
// Placeholders of keys that are replaced by the build system. // // Placeholders of keys that are replaced by the build system.
manifestPlaceholders += [MAPS_API_KEY: "some value"] manifestPlaceholders += ['MAPS_API_KEY': secretProperties.getProperty('MAPS_API_KEY')]
} }