diff --git a/plugin.xml b/plugin.xml
index 7c9add1a4..c48731571 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -155,7 +155,7 @@
-
+
@@ -302,8 +302,6 @@
-
-
diff --git a/src/android/frameworks/pgm-custom.gradle b/src/android/frameworks/pgm-custom.gradle
index ac17586ea..1b5ef420a 100644
--- a/src/android/frameworks/pgm-custom.gradle
+++ b/src/android/frameworks/pgm-custom.gradle
@@ -1,87 +1,17 @@
-def getConvertListe(useAndroidX) {
- def list = [
- ["com.google.android.gms.maps.model", "com.google.android.libraries.maps.model"],
- ["com.google.android.gms.maps", "com.google.android.libraries.maps"]
- ]
-
- if (!useAndroidX) {
- def tmp;
- def listN = list.size()
- for (int i = 0; i < listN; i++) {
- tmp = list[i][0]
- list[i][0] = list[i][1]
- list[i][1] = tmp
- }
- }
- return list
-}
-
-
def searchFileInParents(target) {
def searchPath = target
+
for (int i = 0; i < 8; i++) {
- println(searchPath)
def targetFile = file(searchPath)
+
if(!targetFile.canRead()) {
searchPath = '../' + searchPath;
} else {
return targetFile;
}
}
- return null;
-}
-
-def replacePackages(file, cvtList, useAndroidX) {
- def filePath = file.toPath()
- def lines = java.nio.file.Files.readAllLines(filePath)
- def linesN = lines.size()
- def listN = cvtList.size()
- def anyChanges = false
- for (int i = 0; i < linesN; i++) {
- def line = lines.get(i)
- def needReplace = false;
- if (useAndroidX && line.contains('android.')) {
- needReplace = true
- } else if (!useAndroidX && line.contains('android')) {
- needReplace = true
- }
- if (needReplace) {
- for (int j = 0; j < listN; j++) {
- if (line.contains(cvtList[j][0])) {
- anyChanges = true
- line = line.replaceAll(cvtList[j][0], cvtList[j][1])
- }
- }
- lines.set(i, line)
- }
- }
-
- if (anyChanges) {
- println(" [changed] " + file)
- def fileWriter = new FileWriter(file)
- def output = new BufferedWriter(fileWriter)
- for (int i = 0; i < linesN; i++) {
- output.writeLine(lines.get(i))
- }
- output.flush()
- output.close()
- fileWriter.close()
- }
-
-}
-def replaceFiles(matchingPattern, cvtList, useAndroidX) {
- PatternFilterable patternSet = new PatternSet();
- patternSet.include(matchingPattern);
-
- def matchedFile = project.files(project.getProjectDir().getParentFile().toPath()).getAsFileTree().matching(patternSet)
- matchedFile.each { file ->
- if (!java.nio.file.Files.isReadable(file.toPath())) {
- return
- }
-
- replacePackages(file, cvtList, useAndroidX)
- }
+ return null;
}
android {
@@ -101,82 +31,65 @@ android {
// parse xml file
def widget = new XmlParser().parse(configXmlFile)
+
if (widget.preference == null) {
throw new GradleException("widget is null.")
}
+
if (widget.preference.size() == 0) {
throw new GradleException("Please add '' to the config.xml file.")
}
+
Properties props = new Properties()
def isKeyFound = 0
- props.setProperty("GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION", "16.0.0");
- props.setProperty("GOOGLE_MAPS_ANDROID_SUPPORT_V4_VERSION", "27.1.1");
- props.setProperty("GOOGLE_MAPS_PLAY_SERVICES_VERSION", "16.1.0");
-
+ // Set default versions for play-services-maps and play-services-location
+ //
+ // Google Maps SDK for Android: com.google.android.gms:play-services-maps
+ // Version from 25.06.2024
+ props.setProperty("GOOGLE_MAPS_PLAY_SERVICES_VERSION", "19.0.0");
+ // Location Services for Android: com.google.android.gms:play-services-location
+ // Version from 29.05.2024
+ props.setProperty("GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION", "21.3.0");
widget.preference.each { pref ->
def name = pref.attributes().name
def value = pref.attributes().value
- println("name = " + name);
+
if (name == "GOOGLE_MAPS_ANDROID_API_KEY") {
isKeyFound = 1
props.setProperty(name, value)
}
- if (name == "GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION"||
- name == "GOOGLE_MAPS_PLAY_SERVICES_VERSION" ||
- name == "GOOGLE_MAPS_ANDROID_SUPPORT_V4_VERSION") {
+
+ if (name == "GOOGLE_MAPS_PLAY_SERVICES_VERSION" ||
+ name == "GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION") {
props.setProperty(name, value)
}
}
-
if (isKeyFound == 0) {
throw new GradleException("Please add '' to the config.xml file.")
}
- def hasUseAndroidX = project.ext.has('android.useAndroidX')
- def hasEnableJetifier = project.ext.has('android.enableJetifier')
- def useAndroidX = hasUseAndroidX && hasEnableJetifier &&
- 'true' == project.ext.get('android.useAndroidX') &&
- 'true' == project.ext.get('android.enableJetifier')
-
- //-----------------------------------------------
- // Replace the source code of this plugin
- //-----------------------------------------------
- def cvtList = getConvertListe(useAndroidX)
+ def hasUseAndroidX = project.ext.has('android.useAndroidX') && (project.ext.get('android.useAndroidX') == 'true')
+ def hasEnableJetifier = project.ext.has('android.enableJetifier') && (project.ext.get('android.enableJetifier') == 'true')
+ def useAndroidX = hasUseAndroidX && hasEnableJetifier
- replaceFiles("**/plugin/google/maps/*.java", cvtList, useAndroidX)
-
- if (useAndroidX) {
- //----------
- // maps SDK
- //----------
+ if (!useAndroidX) {
+ throw new GradleException("Android X must be used to use this plugin.")
+ }
- dependencies {
- implementation 'com.google.android.libraries.maps:maps:3.1.0-beta'
- implementation 'com.android.support:multidex:1.0.3'
- }
+ def PLAY_SERVICES_MAPS_VERSION = props.getProperty("GOOGLE_MAPS_PLAY_SERVICES_VERSION")
+ def PLAY_SERVICES_LOCATION_VERSION = props.getProperty("GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION")
- defaultConfig {
- multiDexEnabled true
- }
+ println("---->GOOGLE_MAPS_PLAY_SERVICES_VERSION = ${PLAY_SERVICES_MAPS_VERSION}")
+ println("---->GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION = ${PLAY_SERVICES_LOCATION_VERSION}")
- } else {
- def PLAY_SERVICES_VERSION = props.getProperty("GOOGLE_MAPS_PLAY_SERVICES_VERSION")
- def PLAY_SERVICES_LOCATION_VERSION = props.getProperty("GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION")
- def ANDROID_SUPPORT_V4_VERSION = props.getProperty("GOOGLE_MAPS_ANDROID_SUPPORT_V4_VERSION")
- println("---->GOOGLE_MAPS_PLAY_SERVICES_VERSION = ${PLAY_SERVICES_VERSION}")
- println("---->GOOGLE_MAPS_PLAY_SERVICES_LOCATION_VERSION = ${PLAY_SERVICES_LOCATION_VERSION}")
- println("---->GOOGLE_MAPS_ANDROID_SUPPORT_V4_VERSION = ${ANDROID_SUPPORT_V4_VERSION}")
- dependencies {
- implementation "com.google.android.gms:play-services-maps:${PLAY_SERVICES_VERSION}"
- implementation "com.google.android.gms:play-services-location:${PLAY_SERVICES_LOCATION_VERSION}"
- implementation "com.android.support:support-core-utils:${ANDROID_SUPPORT_V4_VERSION}"
- }
+ dependencies {
+ implementation "com.google.android.gms:play-services-maps:${PLAY_SERVICES_MAPS_VERSION}"
+ implementation "com.google.android.gms:play-services-location:${PLAY_SERVICES_LOCATION_VERSION}"
}
-
buildTypes {
debug {
manifestPlaceholders.GOOGLE_MAPS_ANDROID_API_KEY = props.getProperty("GOOGLE_MAPS_ANDROID_API_KEY")
diff --git a/src/android/frameworks/tbxml-android.gradle b/src/android/frameworks/tbxml-android.gradle
index 4c4edcefc..266b97f9c 100644
--- a/src/android/frameworks/tbxml-android.gradle
+++ b/src/android/frameworks/tbxml-android.gradle
@@ -2,8 +2,11 @@ repositories {
maven { url 'https://maven.google.com' }
mavenCentral()
jcenter()
+
def libsDirPath = System.getProperty("user.dir")
- flatDir{
+
+ // Causes Warning: Using flatDir should be avoided because it doesn't support any meta-data formats.
+ flatDir {
dirs 'src/main/libs', 'libs', "${libsDirPath}/libs"
}
}
diff --git a/src/android/plugin/google/maps/BitmapCache.java b/src/android/plugin/google/maps/BitmapCache.java
index b78d2b791..b13ce4dbc 100644
--- a/src/android/plugin/google/maps/BitmapCache.java
+++ b/src/android/plugin/google/maps/BitmapCache.java
@@ -1,7 +1,7 @@
package plugin.google.maps;
import android.graphics.Bitmap;
-import android.support.v4.util.LruCache;
+import androidx.collection.LruCache;
public class BitmapCache extends LruCache {
diff --git a/src/android/plugin/google/maps/ObjectCache.java b/src/android/plugin/google/maps/ObjectCache.java
index a520cdd99..32a407f9f 100644
--- a/src/android/plugin/google/maps/ObjectCache.java
+++ b/src/android/plugin/google/maps/ObjectCache.java
@@ -1,6 +1,6 @@
package plugin.google.maps;
-import android.support.v4.util.LruCache;
+import androidx.collection.LruCache;
import java.util.HashSet;
diff --git a/src/android/plugin/google/maps/PluginLocationService.java b/src/android/plugin/google/maps/PluginLocationService.java
index 9976e5ddd..c3a864c32 100644
--- a/src/android/plugin/google/maps/PluginLocationService.java
+++ b/src/android/plugin/google/maps/PluginLocationService.java
@@ -9,8 +9,8 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Looper;
-import android.support.annotation.NonNull;
-import android.support.v4.content.PermissionChecker;
+import androidx.annotation.NonNull;
+import androidx.core.content.PermissionChecker;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
diff --git a/src/android/plugin/google/maps/PluginMap.java b/src/android/plugin/google/maps/PluginMap.java
index 0ea45af0f..4340e3024 100644
--- a/src/android/plugin/google/maps/PluginMap.java
+++ b/src/android/plugin/google/maps/PluginMap.java
@@ -16,8 +16,8 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.support.annotation.NonNull;
-import android.support.v4.content.PermissionChecker;
+import androidx.annotation.NonNull;
+import androidx.core.content.PermissionChecker;
import android.util.Base64;
import android.util.Log;
import android.view.Gravity;