Skip to content

Commit

Permalink
chore: update java demo build file to Kotlin and version catalog (#770)
Browse files Browse the repository at this point in the history
* chore: update java demo build file to Kotlin and version catalog

* chore: updates the project name in the settings file
  • Loading branch information
dkhawk authored Nov 1, 2024
1 parent 00cefeb commit 9ca0ba1
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 89 deletions.
60 changes: 0 additions & 60 deletions demo-java/app/build.gradle

This file was deleted.

65 changes: 65 additions & 0 deletions demo-java/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.secrets.gradle.plugin)
}

android {
namespace = "com.example.placesdemo"
compileSdk = 35

defaultConfig {
applicationId = "com.example.placesdemo"
minSdk = 23
targetSdk = 35
versionCode = 1
versionName = "1.0"

multiDexEnabled = true
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}

buildFeatures {
viewBinding = true
}
}

dependencies {
implementation(libs.constraintlayout)
implementation(libs.activity)
implementation(libs.fragment)
implementation(libs.navigation.fragment)
implementation(libs.navigation.ui)

implementation(libs.appcompat)
implementation(libs.material)

implementation(libs.volley)
implementation(libs.glide)
implementation(libs.viewbinding)
implementation(libs.multidex)

// Places and Maps SDKs
implementation(libs.places)
implementation(libs.play.services.maps)
implementation(libs.android.maps.utils)
}

// Secrets for Google Maps API Keys
secrets {
// To add your Google Maps Platform API key to this project:
// 1. Copy local.defaults.properties to secrets.properties
// 2. In the secrets.properties file, replace PLACES_API_KEY=DEFAULT_API_KEY with a key from a
// project with Places API enabled
// 3. In the secrets.properties file, replace MAPS_API_KEY=DEFAULT_API_KEY with a key from a
// project with Maps SDK for Android enabled (can be the same project and key as in Step 2)
defaultPropertiesFileName = "local.defaults.properties"

// Optionally specify a different file name containing your secrets.
// The plugin defaults to "local.properties"
propertiesFileName = "secrets.properties"
}
2 changes: 1 addition & 1 deletion demo-java/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Google LLC
* Copyright 2024 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 Down
23 changes: 0 additions & 23 deletions demo-java/build.gradle

This file was deleted.

6 changes: 6 additions & 0 deletions demo-java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.secrets.gradle.plugin) apply false
}
36 changes: 36 additions & 0 deletions demo-java/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[versions]
activity = "1.9.3"
androidGradlePlugin = "8.6.1"
androidMapsUtils = "3.8.2"
appcompat = "1.7.0"
constraintlayout = "2.2.0"
fragment = "1.8.5"
glide = "4.16.0"
mapsSecretsGradlePlugin = "2.0.1"
material = "1.12.0"
multidex = "2.0.1"
navigationFragment = "2.8.3"
places = "4.0.0"
playServicesMaps = "19.0.0"
viewbinding = "8.7.2"
volley = "1.2.1"

[libraries]
activity = { module = "androidx.activity:activity", version.ref = "activity" }
android-maps-utils = { module = "com.google.maps.android:android-maps-utils", version.ref = "androidMapsUtils" }
appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" }
constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" }
fragment = { module = "androidx.fragment:fragment", version.ref = "fragment" }
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" }
material = { module = "com.google.android.material:material", version.ref = "material" }
multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
navigation-fragment = { module = "androidx.navigation:navigation-fragment", version.ref = "navigationFragment" }
navigation-ui = { module = "androidx.navigation:navigation-ui", version.ref = "navigationFragment" }
places = { module = "com.google.android.libraries.places:places", version.ref = "places" }
play-services-maps = { module = "com.google.android.gms:play-services-maps", version.ref = "playServicesMaps" }
viewbinding = { module = "com.android.databinding:viewbinding", version.ref = "viewbinding" }
volley = { module = "com.android.volley:volley", version.ref = "volley" }

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
secrets-gradle-plugin = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "mapsSecretsGradlePlugin" }
24 changes: 23 additions & 1 deletion demo-java/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
include ':app'
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}

rootProject.name = "Android Places Java Demo"
include(":app")
6 changes: 3 additions & 3 deletions demo-kotlin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[versions]
androidGradlePlugin = "8.6.1"
appcompat = "1.7.0"
coreKtx = "1.13.1"
coreKtx = "1.15.0"
glide = "4.16.0"
kotlin = "2.0.0"
kotlin = "2.0.20"
mapsSecretsGradlePlugin = "2.0.1"
mapsUtilsKtx = "5.1.1"
material = "1.12.0"
multidex = "2.0.1"
places = "4.0.0"
viewbinding = "8.6.1"
viewbinding = "8.7.2"
volley = "1.2.1"
kotlinParcelize = "1.9.24"

Expand Down

0 comments on commit 9ca0ba1

Please sign in to comment.