Skip to content

Commit 7772221

Browse files
authored
fix(tutorials): include MapWithMarker in root build and update Gradle config (#2458)
Include :tutorials:java:MapWithMarker and :tutorials:kotlin:MapWithMarker in settings.gradle.kts, the build-tutorials CI job, and verify_all.sh. Update both app/build.gradle.kts files to use the root version catalog, proguard-android-optimize.txt, AndroidX test runner, and Java 17 compileOptions, and refresh the tutorial READMEs.
1 parent 6210c6d commit 7772221

9 files changed

Lines changed: 59 additions & 40 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ jobs:
145145
./gradlew :tutorials:kotlin:Polygons:assembleDebug
146146
./gradlew :tutorials:java:CurrentPlaceDetailsOnMap:assembleDebug
147147
./gradlew :tutorials:kotlin:CurrentPlaceDetailsOnMap:assembleDebug
148+
./gradlew :tutorials:java:MapWithMarker:assembleDebug
149+
./gradlew :tutorials:kotlin:MapWithMarker:assembleDebug
148150
149151
test:
150152
runs-on: ubuntu-latest

‎scripts/verify_all.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ MODULES=(
4949
":tutorials:kotlin:Polygons"
5050
":tutorials:java:CurrentPlaceDetailsOnMap"
5151
":tutorials:kotlin:CurrentPlaceDetailsOnMap"
52+
":tutorials:java:MapWithMarker"
53+
":tutorials:kotlin:MapWithMarker"
5254
)
5355

5456
# Parse arguments

‎settings.gradle.kts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ include(":tutorials:java:CurrentPlaceDetailsOnMap")
7373
project(":tutorials:java:CurrentPlaceDetailsOnMap").projectDir = file("tutorials/java/CurrentPlaceDetailsOnMap/app")
7474
include(":tutorials:kotlin:CurrentPlaceDetailsOnMap")
7575
project(":tutorials:kotlin:CurrentPlaceDetailsOnMap").projectDir = file("tutorials/kotlin/CurrentPlaceDetailsOnMap/app")
76+
include(":tutorials:java:MapWithMarker")
77+
project(":tutorials:java:MapWithMarker").projectDir = file("tutorials/java/MapWithMarker/app")
78+
include(":tutorials:kotlin:MapWithMarker")
79+
project(":tutorials:kotlin:MapWithMarker").projectDir = file("tutorials/kotlin/MapWithMarker/app")
7680
// Add others as needed, starting with these for now
7781

7882
// Visual Testing

‎tutorials/java/MapWithMarker/README.md‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,32 @@ This sample goes hand in hand with a tutorial for the Google Maps Android API:
77
Prerequisites
88
--------------
99

10-
- Android API level 21+
10+
- Android API level 24+
1111
- Latest Android Build Tools
1212
- Google Repository
1313
- Google Play Services
1414

1515
Getting started
1616
---------------
1717

18-
This sample uses the Gradle build system.
18+
This sample uses the Gradle build system and is part of the root `android-samples` Gradle build.
1919

2020
1. Download the samples by cloning this repository or downloading an archived
2121
snapshot. (See the options at the top of the page.)
22-
1. In Android Studio, use "Open an existing Android Studio project". Next select the
23-
`tutorials/java/MapWithMarker` directory that you downloaded
24-
1. If prompted for a gradle configuration, accept the default settings.
25-
Alternatively use the `gradlew build` command to build the project directly.
22+
1. In Android Studio, select "Open" (or "Open an existing Android Studio project") and choose the
23+
root `android-samples` directory that you downloaded.
24+
1. Select the `tutorials.java.MapWithMarker` run configuration in Android Studio, or build the
25+
module from the root of this repository using Gradle.
2626

2727
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
2828

29+
From the root of this repository, add your key to `secrets.properties` (see
30+
`local.defaults.properties` for the format) and run:
31+
32+
```
33+
./gradlew :tutorials:java:MapWithMarker:assembleDebug
34+
```
35+
2936
Support
3037
-------
3138

@@ -35,11 +42,11 @@ If you have discovered an issue with the Google Maps Android API v2, please see
3542
the resources here: https://developers.google.com/maps/documentation/android-sdk/support
3643

3744
If you've found an error in these samples, please file an issue:
38-
https://github.com/googlemaps/android-samples/issues
45+
https://github.com/googlemaps-samples/android-samples/issues
3946

4047
![Analytics](https://ga-beacon.appspot.com/UA-12846745-20/android-samples-apidemos/readme?pixel)
4148

4249
License
4350
-------
4451

45-
Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo.
52+
Please refer to the [LICENSE](https://github.com/googlemaps-samples/android-samples/blob/main/LICENSE) at the root of this repo.

‎tutorials/java/MapWithMarker/app/build.gradle.kts‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ android {
2828
targetSdk = libs.versions.targetSdk.get().toInt()
2929
versionCode = libs.versions.versionCode.get().toInt()
3030
versionName = libs.versions.versionName.get()
31-
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
31+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3232
}
3333

3434
buildFeatures {
@@ -38,20 +38,25 @@ android {
3838
buildTypes {
3939
release {
4040
isMinifyEnabled = false
41-
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
41+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
4242
}
4343
}
4444

45+
compileOptions {
46+
sourceCompatibility = JavaVersion.toVersion(libs.versions.javaVersion.get())
47+
targetCompatibility = JavaVersion.toVersion(libs.versions.javaVersion.get())
48+
}
49+
4550
namespace = "com.example.mapwithmarker"
4651
}
4752

4853
dependencies {
49-
implementation(libs.playServicesMaps)
50-
implementation(platform(libs.kotlinBom))
54+
implementation(libs.play.services.maps)
55+
implementation(platform(libs.kotlin.bom))
5156
implementation(libs.appcompat)
5257
testImplementation(libs.junit)
53-
androidTestImplementation(libs.androidxTestExtJunit)
54-
androidTestImplementation(libs.espressoCore)
58+
androidTestImplementation(libs.ext.junit)
59+
androidTestImplementation(libs.espresso.core)
5560
}
5661

5762
secrets {
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
## This file must *NOT* be checked into Version Control Systems,
2-
# as it contains information specific to your local configuration.
3-
#
4-
# Location of the SDK. This is only used by Gradle.
5-
# For customization when using a Version Control System, please read the
6-
# header note.
7-
#Mon Apr 06 10:50:09 PDT 2020
81
MAPS_API_KEY=DEFAULT_API_KEY

‎tutorials/kotlin/MapWithMarker/README.md‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This sample goes hand in hand with a tutorial for the Google Maps Android API:
77
Prerequisites
88
--------------
99

10-
- Android API level 21+
10+
- Android API level 24+
1111
- Latest Android Build Tools
1212
- Android Support Repository
1313
- Google Repository
@@ -16,17 +16,24 @@ Prerequisites
1616
Getting started
1717
---------------
1818

19-
This sample uses the Gradle build system.
19+
This sample uses the Gradle build system and is part of the root `android-samples` Gradle build.
2020

2121
1. Download the samples by cloning this repository or downloading an archived
2222
snapshot. (See the options at the top of the page.)
23-
1. In Android Studio, use "Open an existing Android Studio project". Next select the
24-
`tutorials/kotlin/MapWithMarker` directory that you downloaded
25-
1. If prompted for a gradle configuration, accept the default settings.
26-
Alternatively use the `gradlew build` command to build the project directly.
23+
1. In Android Studio, select "Open" (or "Open an existing Android Studio project") and choose the
24+
root `android-samples` directory that you downloaded.
25+
1. Select the `tutorials.kotlin.MapWithMarker` run configuration in Android Studio, or build the
26+
module from the root of this repository using Gradle.
2727

2828
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
2929

30+
From the root of this repository, add your key to `secrets.properties` (see
31+
`local.defaults.properties` for the format) and run:
32+
33+
```
34+
./gradlew :tutorials:kotlin:MapWithMarker:assembleDebug
35+
```
36+
3037
Support
3138
-------
3239

@@ -36,11 +43,11 @@ If you have discovered an issue with the Google Maps Android API v2, please see
3643
the resources here: https://developers.google.com/maps/documentation/android-sdk/support
3744

3845
If you've found an error in these samples, please file an issue:
39-
https://github.com/googlemaps/android-samples/issues
46+
https://github.com/googlemaps-samples/android-samples/issues
4047

4148
![Analytics](https://ga-beacon.appspot.com/UA-12846745-20/android-samples-apidemos/readme?pixel)
4249

4350
License
4451
-------
4552

46-
Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo.
53+
Please refer to the [LICENSE](https://github.com/googlemaps-samples/android-samples/blob/main/LICENSE) at the root of this repo.

‎tutorials/kotlin/MapWithMarker/app/build.gradle.kts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2-
3-
/*
2+
3+
/*
44
* Copyright 2024 Google LLC
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,7 @@ android {
3030
targetSdk = libs.versions.targetSdk.get().toInt()
3131
versionCode = libs.versions.versionCode.get().toInt()
3232
versionName = libs.versions.versionName.get()
33-
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
33+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3434
}
3535

3636
buildFeatures {
@@ -40,7 +40,7 @@ android {
4040
buildTypes {
4141
release {
4242
isMinifyEnabled = false
43-
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
43+
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
4444
}
4545
}
4646

@@ -59,15 +59,15 @@ kotlin {
5959
}
6060

6161
dependencies {
62-
implementation(libs.coreKtx)
63-
implementation(libs.kotlinStdlib)
62+
implementation(libs.core.ktx)
63+
implementation(libs.kotlin.stdlib)
6464
implementation(libs.appcompat)
65-
implementation(libs.playServicesMaps)
65+
implementation(libs.play.services.maps)
6666

6767
// Tests
6868
testImplementation(libs.junit)
69-
androidTestImplementation(libs.androidxTestExtJunit)
70-
androidTestImplementation(libs.espressoCore)
69+
androidTestImplementation(libs.ext.junit)
70+
androidTestImplementation(libs.espresso.core)
7171
}
7272

7373
secrets {
@@ -80,4 +80,4 @@ secrets {
8080
// A properties file containing default secret values. This file can be
8181
// checked in version control.
8282
defaultPropertiesFileName = "local.defaults.properties"
83-
}
83+
}

‎tutorials/kotlin/MapWithMarker/app/src/main/java/com/example/mapwithmarker/MapsMarkerActivity.kt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package com.example.mapwithmarker
1616

1717
import android.os.Bundle
18-
import android.widget.Toast
1918
import androidx.appcompat.app.AppCompatActivity
2019
import com.google.android.gms.maps.CameraUpdateFactory
2120
import com.google.android.gms.maps.GoogleMap

0 commit comments

Comments
 (0)