Bump up to v2.6.2
MODIFY
.travis.yml
.travis.yml
@@ -95,4 +95,5 @@ install:
- npm i > /dev/null
script
+ - npm test
- /bin/bash build_test.sh

MODIFY
README.md
README.md
-# Cordova GoogleMaps plugin for Android, iOS and Browser v2.6.1
+# Cordova GoogleMaps plugin for Android, iOS and Browser v2.6.2
| Download | Build test (master branch)|
|----------|---------------------------|
---------------------------------------------------------------------------------------------------------
## Release Notes
+ - **v2.6.1**
+ - Fix: (Android) build error
+
- **v2.6.1**
- Fix: (Android) Conflicting with `OneSignal-Cordova-SDK`
- Fix: (iOS) App crashes when marker url isn't valid.

MODIFY
build_test.sh
build_test.sh
@@ -18,7 +18,3 @@ fi
if [ ${DO_BUILD} -eq 1 ]; then
cordova-paramedic --verbose --platform ${CORDOVA_PLATFORM} --justBuild --plugin ./tests;
fi
-
-if [[ ${CORDOVA_PLATFORM} == "browser" ]]; then
- npm run test
-fi

MODIFY
package.json
package.json
{
"name": "cordova-plugin-googlemaps",
- "version": "2.6.1",
+ "version": "2.6.2",
"description": "Google Maps native SDK for Android and iOS, and Google Maps JavaScript API v3 for browser.",
"cordova": {
"id": "cordova-plugin-googlemaps",

MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.6.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.6.2" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="Promise" src="www/Promise.js" />
<asset src="www/promise-7.0.4.min.js.map" target="promise-7.0.4.min.js.map" />

MODIFY
src/android/frameworks/apikey.gradle
src/android/frameworks/apikey.gradle
-android {
- def searchPath = 'app/src/main/res/xml/config.xml'
- def finalConfigXmlFile = null;
+def searchFileInParents(target) {
+ def searchPath = target
for (int i = 0; i < 8; i++) {
- def configXmlFile = file(searchPath)
- println(configXmlFile.absolutePath)
- if(!configXmlFile.canRead()) {
+ println(searchPath)
+ def targetFile = file(searchPath)
+ if(!targetFile.canRead()) {
searchPath = '../' + searchPath;
} else {
- finalConfigXmlFile = configXmlFile;
- break;
+ return targetFile;
+ }
}
+ return null;
}
- if (finalConfigXmlFile == null) {
- throw new GradleException("Could not read config.xml file.")
+android {
+ def searchPath = 'app/src/main/res/xml/config.xml'
+ // #1. Find (project)/config.xml file,
+ // because ionic capacitor does not copy <preference> nodes
+ def configXmlFile = searchFileInParents("config.xml")
+
+ if (configXmlFile == null) {
+ // #2. Find (project)/app/src/main/res/xml/config.xml file,
+ // cordova should copy <preference> to this file
+ configXmlFile = searchFileInParents("app/src/main/res/xml/config.xml")
+ }
+
+ if (configXmlFile == null) {
+ throw new GradleException("Can not find config.xml file.")
}
// parse xml file
- def widget = new XmlParser().parse(finalConfigXmlFile)
+ def widget = new XmlParser().parse(configXmlFile)
if (widget.preference == null) {
throw new GradleException("widget is null.")
}
- println(widget.preference[0].attributes().name);
+ if (widget.preference.size() == 0) {
+ throw new GradleException("Please add '<preference name=\"GOOGLE_MAPS_ANDROID_API_KEY\" />' to the config.xml file.")
+ }
+ println("preference = " + widget.preference.size())
Properties props = new Properties()
def found = 0
widget.preference.each { pref ->
def name = pref.attributes().name
def value = pref.attributes().value
+ println("name = " + name + ", value = " + value);
if (name == "GOOGLE_MAPS_ANDROID_API_KEY") {
- //println("name = " + name + ", value = " + value);
found = 1
props.setProperty(name, value);
}
@@ -36,7 +51,7 @@ android {
if (found == 0) {
- throw new GradleException("You need to declare GOOGLE_MAPS_ANDROID_API_KEY in config.xml.")
+ throw new GradleException("Please add '<preference name=\"GOOGLE_MAPS_ANDROID_API_KEY\" />' to the config.xml file.")
}

Bump up to v2.6.2