-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
142 lines (120 loc) · 4.97 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
android {
namespace "com.google.maps.flutter.navigation_example"
compileSdk flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "com.google.maps.flutter.navigation_example"
// Navigation SDK supports SDK 23 and later.
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
// Set this to the languages you actually use, otherwise you'll include resource strings
// for all languages supported by the Navigation SDK.
multiDexEnabled true
testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner"
resourceConfigurations += ['en']
// Extract MAPS_API_KEY from Dart defines or environment variables
// and use it as manifest placeholder.
def mapsApiKey = System.env.MAPS_API_KEY ?: findDartDefineValue("MAPS_API_KEY") ?: ""
manifestPlaceholders = [MAPS_API_KEY: mapsApiKey]
}
buildTypes {
release {
// Run ProGuard. Note that the Navigation SDK includes its own ProGuard configuration.
// The configuration is included transitively by depending on the Navigation SDK.
// If the ProGuard step takes too long, consider enabling multidex for development work
// instead.
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
testOptions {
execution "ANDROIDX_TEST_ORCHESTRATOR"
}
}
flutter {
source '../..'
}
dependencies {
implementation "androidx.car.app:app:1.4.0"
implementation "androidx.car.app:app-projected:1.4.0"
implementation 'com.google.android.libraries.navigation:navigation:6.0.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
androidTestUtil "androidx.test:orchestrator:1.4.2"
}
secrets {
// This example application employs the Gradle plugin
// com.google.android.libraries.mapsplatform.secrets-gradle-plugin
// to securely manage the Google Maps API key.
// For more information on the plugin, visit:
// https://developers.google.com/maps/documentation/android-sdk/secrets-gradle-plugin
// 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.properties'
// Ignore all keys matching the regexp "sdk.*"
ignoreList.add("sdk.*")
// Ignore all keys matching the regexp "flutter.*"
ignoreList.add("flutter.*")
}
// Helper function to extract specific Dart define value
def findDartDefineValue(key) {
def encodedDartDefines = project.hasProperty('dart-defines') ? project.property('dart-defines') : ""
def defines = encodedDartDefines.split(",").collectEntries { String it ->
def define = new String(it.decodeBase64(), 'UTF-8').split('=')
return [(define.first()): define.last()]
}
return defines.containsKey(key) ? defines[key] : null
}