Skip to content
Open
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,21 @@ The colors of the text, line, and shadow are also all configurable (e.g., based

## Internal usage attribution ID

This library calls the MapsApiSettings.addInternalUsageAttributionId method, which helps Google
understand which libraries and samples are helpful to developers and is optional. Instructions for
opting out of the identifier are provided in
[reference documentation](maps-compose/src/main/java/com/google/maps/android/compose/internal/GoogleMapsInitializer.kt#L77-L82).
This library calls the `addInternalUsageAttributionId` method, which helps Google understand which libraries and samples are helpful to developers and is optional. Instructions for opting out of the identifier are provided below.

If you wish to disable this, you can do so by removing the initializer in your `AndroidManifest.xml` using the `tools:node="remove"` attribute:

```xml
<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
android:exported="false"
tools:node="merge">
<meta-data
android:name="com.google.maps.android.compose.utils.attribution.AttributionIdInitializer"
tools:node="remove" />
</provider>
```

## Contributing

Expand Down
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,11 @@ allprojects {
// {x-release-please-start-version}
version = "7.0.0"
// {x-release-please-end}
}

tasks.register<Exec>("installAndLaunch") {
description = "Installs and launches the demo app."
group = "install"
dependsOn(":maps-app:installDebug")
commandLine("adb", "shell", "am", "start", "-n", "com.google.maps.android.compose/.MainActivity")
}
22 changes: 12 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
[versions]
activitycompose = "1.12.1"
agp = "8.13.1"
activitycompose = "1.12.2"
agp = "8.13.2"

Check warning

Code scanning / Android Lint

Obsolete Android Gradle Plugin Version Warning

A newer version of com.android.application than 8.13.2 is available: 9.0.0

Check warning

Code scanning / Android Lint

Obsolete Android Gradle Plugin Version Warning

A newer version of com.android.tools.build:gradle than 8.13.2 is available: 9.0.0
androidCore = "1.7.0"
androidx-core = "1.17.0"
androidxtest = "1.7.0"
compose-bom = "2025.12.00"
androidx-startup = "1.2.0"
compose-bom = "2026.01.00"
dokka = "2.1.0"
espresso = "3.7.0"
gradleMavenPublishPlugin = "0.35.0"
gradleMavenPublishPlugin = "0.36.0"
jacoco-plugin = "0.2.1"
junit = "4.13.2"
junitktx = "1.3.0"
kotlin = "2.2.21"
kotlin = "2.3.0"
kotlinxCoroutines = "1.10.2"
leakcanaryAndroid = "2.14"
mapsecrets = "2.0.1"
mapsktx = "5.2.1"
mapsktx = "5.2.2"
material3 = "1.4.0"
materialIconsExtendedAndroid = "1.7.8"
mockk = "1.14.6"
mockkAndroid = "1.14.6"
mockk = "1.14.7"
mockkAndroid = "1.14.7"
org-jacoco-core = "0.8.14"
screenshot = "0.0.1-alpha12"
screenshot = "0.0.1-alpha13"
constraintlayout = "2.2.1"
material = "1.13.0"
robolectric = "4.16"
robolectric = "4.16.1"
truth = "1.4.5"

[libraries]
Expand All @@ -40,6 +41,7 @@
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
androidx-test-compose-ui = { module = "androidx.compose.ui:ui-test-junit4" }
androidx-startup-runtime = { module = "androidx.startup:startup-runtime", version.ref = "androidx-startup" }
androidx-test-core = { module = "androidx.test:core", version.ref = "androidCore" }
androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso" }
androidx-test-junit-ktx = { module = "androidx.test.ext:junit-ktx", version.ref = "junitktx" }
Expand Down
6 changes: 6 additions & 0 deletions maps-app/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-sdk tools:overrideLibrary="io.mockk.android,io.mockk.proxy.android" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
import com.google.common.truth.Truth.assertThat
import com.google.maps.android.compose.LatLngSubject.Companion.assertThat
import com.google.maps.android.compose.internal.DefaultGoogleMapsInitializer
import com.google.maps.android.compose.internal.InitializationState
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Rule
Expand All @@ -54,13 +52,7 @@ class GoogleMapViewTests {
val countDownLatch = CountDownLatch(1)

val appContext: Context = InstrumentationRegistry.getInstrumentation().targetContext
val googleMapsInitializer = DefaultGoogleMapsInitializer()

runBlocking {
googleMapsInitializer.initialize(appContext)
}

assertThat(googleMapsInitializer.state.value).isEqualTo(InitializationState.SUCCESS)

composeTestRule.setContent {
GoogleMapView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ package com.google.maps.android.compose

import android.graphics.Point
import androidx.compose.foundation.layout.Box
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.dp
import com.google.android.gms.maps.model.CameraPosition
import com.google.android.gms.maps.model.LatLng
Expand All @@ -44,6 +46,7 @@ class ScaleBarTests {
val composeTestRule = createComposeRule()

private lateinit var cameraPositionState: CameraPositionState
private lateinit var density: Density

private fun initScaleBar(initialZoom: Float, initialPosition: LatLng) {
check(hasValidApiKey) { "Maps API key not specified" }
Expand All @@ -55,6 +58,7 @@ class ScaleBarTests {
)

composeTestRule.setContent {
density = LocalDensity.current
Box {
GoogleMap(
cameraPositionState = cameraPositionState,
Expand Down Expand Up @@ -87,7 +91,9 @@ class ScaleBarTests {
val projection = cameraPositionState.projection
projection?.let { proj ->
val widthInDp = 65.dp
val widthInPixels = widthInDp.value.toInt()
val widthInPixels = with(density) {
widthInDp.toPx().toInt()
}

val upperLeftLatLng = proj.fromScreenLocation(Point(0, 0))
val upperRightLatLng = proj.fromScreenLocation(Point(0, widthInPixels))
Expand Down

This file was deleted.

Loading