Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ jobs:
./gradlew :snippets:app-utils-ktx:assembleDebug
./gradlew :snippets:app-compose:assembleDebug
./gradlew :snippets:app-places-ktx:assembleDebug
./gradlew :snippets:app-rx:assembleDebug
./gradlew :snippets:app-utils:assembleDebug

build-tutorials:
Expand All @@ -134,13 +133,25 @@ jobs:
run: |
./gradlew :tutorials:kotlin:Polygons:assembleDebug

test: # used as required status check
test:
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- build-ApiDemos
- build-WearOS
- build-FireMarkers
- build-Snippets
- build-tutorials
- build-FireMarkers
steps:
- run: echo "Fail if all other steps are not successful"
- uses: actions/checkout@v4
- name: set up Java 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '21'

- name: Run Unit Tests
run: ./gradlew testDebugUnitTest

- name: Run Lint
run: ./gradlew lintDebug
17 changes: 9 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
java-version: '21'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Check documentation versions
run: python3 scripts/update_docs_versions.py --check

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
Expand All @@ -44,7 +52,6 @@ jobs:
./gradlew :snippets:app:lintGmsDebug
./gradlew :snippets:app-utils:lintDebug
./gradlew :snippets:app-utils-ktx:lintDebug
./gradlew :snippets:app-rx:lintDebug
./gradlew :snippets:app-places-ktx:lintDebug
./gradlew :snippets:app-ktx:lintDebug
./gradlew :snippets:app-compose:lintDebug
Expand Down Expand Up @@ -87,12 +94,6 @@ jobs:
sarif_file: snippets/app-utils-ktx/build/reports/lint-results-debug.sarif
category: snippets-app-utils-ktx

- name: Upload SARIF for snippets:app-rx
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: snippets/app-rx/build/reports/lint-results-debug.sarif
category: snippets-app-rx

- name: Upload SARIF for snippets:app-places-ktx
uses: github/codeql-action/upload-sarif@v3
with:
Expand Down
12 changes: 5 additions & 7 deletions FireMarkers/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ plugins {
alias(libs.plugins.kotlin.serialization) // Provides Kotlin serialization capabilities.
}

gradle.projectsEvaluated {
if (rootProject.file("app/google-services.json").exists()) {
project(":app").pluginManager.apply("com.google.gms.google-services")
println("Applied Google Services plugin.")
} else {
println("google-services.json not found — skipping plugin application")
}
if (file("google-services.json").exists()) {
apply(plugin = "com.google.gms.google-services")
println("Applied Google Services plugin.")
} else {
println("google-services.json not found — skipping Google Services plugin")
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class FireMarkersApplication : Application() {
val mapsApiKey =
bundle.getString("com.google.android.geo.API_KEY") // Key name is important!

if (mapsApiKey == null || mapsApiKey.isBlank() || mapsApiKey == "DEFAULT_API_KEY") {
if (mapsApiKey.isNullOrBlank() || mapsApiKey == "DEFAULT_API_KEY") {
Toast.makeText(
this,
"Maps API Key was not set in secrets.properties",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ class MarkersViewModel @Inject constructor(
}

override fun onCancelled(error: DatabaseError) {
Log.e(TAG, "[$viewModelId] Database error on markers: ${error.message}")
viewModelScope.launch {
_errorEvents.emit("Database error on markers: ${error.message}")
}
handleDatabaseError(error, "markers")
}
})
}
Expand Down Expand Up @@ -187,14 +184,23 @@ class MarkersViewModel @Inject constructor(
}

override fun onCancelled(error: DatabaseError) {
Log.e(TAG, "[$viewModelId] DB error on animation: ${error.message}")
viewModelScope.launch {
_errorEvents.emit("DB error on animation: ${error.message}")
}
handleDatabaseError(error, "animation")
}
})
}

private fun handleDatabaseError(error: DatabaseError, context: String) {
val msg = if (error.code == DatabaseError.PERMISSION_DENIED) {
"Permission Denied ($context): Check your Firebase Database Rules."
} else {
"Database error ($context): ${error.message}"
}
Log.e(TAG, "[$viewModelId] $msg")
viewModelScope.launch {
_errorEvents.emit(msg)
}
}

/**
* Toggles the animation state (running/paused) in Firebase.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class MarkersViewModelTest {
listenerCaptor.firstValue.onCancelled(error)
testDispatcher.scheduler.advanceUntilIdle()

assertThat(errorMessage).isEqualTo("DB error on animation: Test Error")
assertThat(errorMessage).isEqualTo("Database error (animation): Test Error")
job.cancel()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock-maker-inline
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ To run the samples, you will need:
1. In the welcome screen of Android Studio, select "Open an Existing project"
1. Select one of the sample directories from this repository

## Verifying the build

To verify that all samples build and pass tests, run:

```bash
./scripts/verify_all.sh
```

Alternatively, use the `gradlew build` command to build the project directly or download an APK
under [releases](https://github.com/googlemaps/android-samples/releases).

Expand Down
48 changes: 33 additions & 15 deletions WearOS/Wearable/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Google LLC
* Copyright 2026 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,20 +21,20 @@ plugins {
}

android {
compileSdk = 35
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
applicationId = "com.example.wearos"
minSdk = 23
targetSdk = 31
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
versionCode = 1
versionName = libs.versions.versionName.get()
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}

Expand All @@ -45,10 +45,6 @@ android {
sarifOutput = layout.buildDirectory.file("reports/lint-results-debug.sarif").get().asFile
}

kotlinOptions {
jvmTarget = "21"
}

kotlin {
jvmToolchain(21)
}
Expand All @@ -57,15 +53,37 @@ android {
// [START maps_wear_os_dependencies]
dependencies {
// [START_EXCLUDE]
implementation("androidx.core:core-ktx:1.15.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are keeping this dependencies as numerics, so they can be read from the region tag.

implementation(libs.core.ktx)
implementation(platform(libs.kotlin.bom))
implementation(libs.kotlin.stdlib)
// [END_EXCLUDE]
compileOnly("com.google.android.wearable:wearable:2.9.0")
implementation("com.google.android.support:wearable:2.9.0")
implementation("com.google.android.gms:play-services-maps:19.0.0")
// Modern Android projects use version catalogs to manage dependencies. To include the necessary dependencies,
// first add the following to your libs.versions.toml file:
//
// [versions]
// playServicesMaps = "20.0.0"
// wear = "1.3.0"
// wearable = "2.9.0"
//
// [libraries]
// play-services-maps = { group = "com.google.android.gms", name = "play-services-maps", version.ref = "playServicesMaps" }
// wear = { group = "androidx.wear", name = "wear", version.ref = "wear" }
// wearable-compile = { group = "com.google.android.wearable", name = "wearable", version.ref = "wearable" }
// wearable-support = { group = "com.google.android.support", name = "wearable", version.ref = "wearable" }

compileOnly(libs.wearable.compile)
implementation(libs.wearable.support)
implementation(libs.play.services.maps)

// This dependency is necessary for ambient mode
implementation("androidx.wear:wear:1.3.0")
implementation(libs.wear)

// If your project does not use a version catalog, you can use the following dependencies instead:
//
// compileOnly("com.google.android.wearable:wearable:2.9.0")
// implementation("com.google.android.support:wearable:2.9.0")
// implementation("com.google.android.gms:play-services-maps:20.0.0")
// implementation("androidx.wear:wear:1.3.0")
}
// [END maps_wear_os_dependencies]

Expand Down
13 changes: 13 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5760d82d08e6c26884debb23736ea57/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/879378f84c64b2c76003b97a32968399/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5760d82d08e6c26884debb23736ea57/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/879378f84c64b2c76003b97a32968399/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/021e528cbed860c875a9016f29ee13c1/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/6141bf023dcc7a96c47cad75c59b054e/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5760d82d08e6c26884debb23736ea57/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/879378f84c64b2c76003b97a32968399/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9b6bab41c3ef2acea6116b7821b8dc11/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/a6eb06d81d82a782734ef3b616ba2684/redirect
toolchainVendor=JETBRAINS
toolchainVersion=21
Loading
Loading