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
94 changes: 0 additions & 94 deletions android/build.gradle

This file was deleted.

124 changes: 124 additions & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// 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.
// 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.

buildscript {
val kotlinVersion = "2.3.20"
repositories {
google()
mavenCentral()
// Only needed to resolve ktfmt below (development/CI-only, gated by -Pktfmt).
if (providers.gradleProperty("ktfmt").isPresent) {
maven { url = uri("https://plugins.gradle.org/m2/") }
}
}

dependencies {
classpath("com.android.tools.build:gradle:8.8.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
// ktfmt (Kotlin formatter) is a development/CI-only tool. Pulling it onto the classpath
// (and applying it below) is gated behind -Pktfmt so it is never forced on apps that
// depend on this plugin. Enabled by `melos run format:android`.
if (providers.gradleProperty("ktfmt").isPresent) {
classpath("com.ncorti.ktfmt.gradle:plugin:0.21.0")
}
}
}

plugins {
id("com.android.library")
}

group = "com.google.maps.flutter.driver"
version = "1.0-SNAPSHOT"

allprojects {
repositories {
google()
mavenCentral()
}
}

// Apply the Kotlin Gradle Plugin (KGP) only when consumed by AGP < 9. AGP 9+ ships built-in Kotlin,
// so applying KGP there is unnecessary and triggers a Flutter deprecation warning. Keeping it
// conditional preserves compatibility for apps still on AGP 8.
// https://docs.flutter.dev/release/breaking-changes/migrate-to-built-in-kotlin/for-plugin-authors#supporting-flutter-versions-earlier-than-3-44
val agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.substringBefore('.').toInt()
if (agpMajor < 9) {
apply(plugin = "org.jetbrains.kotlin.android")
}

// ktfmt is applied only for development/CI formatting (-Pktfmt), so it is never forced on apps
// that depend on this plugin. Run via `melos run format:android` (which passes -Pktfmt).
if (providers.gradleProperty("ktfmt").isPresent) {
apply(plugin = "com.ncorti.ktfmt.gradle")
// Configured dynamically (no compile-time type reference) so this script still compiles when
// ktfmt is absent from the classpath, i.e. for apps that depend on this plugin.
extensions.getByName("ktfmt").withGroovyBuilder { "googleStyle"() }
}

android {
namespace = "com.google.maps.flutter.driver"

compileSdk = 36

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
getByName("test") {
java.srcDirs("src/test/kotlin")
}
}

defaultConfig {
minSdk = 26
}

testOptions {
unitTests {
isIncludeAndroidResources = true
all {
it.testLogging {
events("passed", "skipped", "failed", "standardOut", "standardError")
showStandardStreams = true
}
it.outputs.upToDateWhen { false }
}
}
}
}

// Configure the Kotlin JVM target via the compilerOptions DSL (replaces the deprecated
// android.kotlinOptions block). Configured through the extension so it works whether the Kotlin
// plugin is applied conditionally (AGP < 9) or provided by AGP's built-in Kotlin (AGP 9+). The
// static `kotlin { }` accessor is not generated for imperatively-applied plugins.
project.extensions.configure(org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension::class.java) {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

dependencies {
implementation("com.google.android.libraries.mapsplatform.transportation:transportation-driver:7.0.0")
implementation("androidx.startup:startup-runtime:1.2.0")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("io.mockk:mockk:1.13.9")
testImplementation("junit:junit:4.13.2")
testImplementation("org.robolectric:robolectric:4.11.1")
}
4 changes: 2 additions & 2 deletions android/settings.gradle → android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 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 @@ -12,4 +12,4 @@
// See the License for the specific language governing permissions and
// limitations under the License.

rootProject.name = 'google_driver_flutter'
rootProject.name = "google_driver_flutter"
20 changes: 12 additions & 8 deletions example/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@ android {
compileSdk = flutter.compileSdkVersion
ndkVersion = "28.2.13676358"

compileOptions {
compileOptions {
// Flag to enable support for the new language APIs
isCoreLibraryDesugaringEnabled = true
// Sets Java compatibility to Java 11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
// Sets Java compatibility to Java 17
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

// Set this to the languages you actually use, otherwise you'll include resource strings
Expand Down Expand Up @@ -105,6 +101,14 @@ android {
}
}

// Configure the Kotlin JVM target via the compilerOptions DSL (replaces the deprecated
// android.kotlinOptions block).
kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}

flutter {
source = "../.."
}
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion example/android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pluginManagement {
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.13.0" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
id("org.jetbrains.kotlin.android") version "2.3.20" apply false
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") version "2.0.1" apply false
}

Expand Down
2 changes: 1 addition & 1 deletion melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ scripts:
run: |
if [ -d "example" ]; then cd example; fi && \
if [ ! -f android/gradlew ]; then flutter build apk --config-only; fi &&
cd android && ./gradlew ktfmtFormat
cd android && ./gradlew -Pktfmt ktfmtFormat
exec:
concurrency: 1
failFast: true
Expand Down
Loading