Hi everyone,
I am building an Ionic app and tried to implement this plugin into my app. I have followed the tutorial on https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Tutorial-for-Mac and it works great on iOS. However when I try to compile and run on Android, I get the following error:

I googled the problem and didn't have any progress, I tried the following steps and still no luck:
cordova plugim rm plugin.google.maps
cordova plugin rm com.google.playservices
cordova plugin add https://github.com/wf9a5m75/google-play-services#v23
cordova plugin add plugin.google.maps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"
Here is my list of plugins:
com.google.playservices 23.0.0 "Google Play Services for Android"
com.googlemaps.ios 1.9.2 "Google Map iOS SDK for Cordova"
com.ionic.keyboard 1.0.4 "Keyboard"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
plugin.google.maps 1.2.5 "phonegap-googlemaps-plugin"
plugin.http.request 1.0.4 "phonegap-http-request"
Any help is much appreciated!
Did you install cordova 4.0? I think it is not compatible yet
Hi Hirbod,
Thanks for the prompt reply!
I just checked and I am using Cordova 5.0, does that mean I will have to wait for the plugin to update?
Thanks!
(I have multiple github accounts if it's causing any confusion)
Yes, as far as I know, the plugin does not work on the Cordova android 4.0 platform
Right, Thanks very much!
I had this error but it is fixed on the test branch. To use it you need to run these commands:
cordova plugin rm plugin.google.maps
cordova plugin add https://github.com/wf9a5m75/phonegap-googlemaps-plugin@test --variable API_KEY_FOR_ANDROID="<put your API key in here>"
Never mind about that, it built successfully only because it wasn't actually grabbing the plugin since I was using @test instead of #test. I'm getting the same error.
Guess we will have to wait until it updates :(
Sent from my iPhone
On 26 Apr 2015, at 19:41, Joshua Skrzypek [email protected] wrote:
Never mind about that, it built successfully only because it wasn't actually grabbing the plugin since I was using @test instead of #test. I'm getting the same error.
—
Reply to this email directly or view it on GitHub.
Yup. I tried digging into the native code, definitely not my bailiwick, but that was a headache and a half and went nowhere. My suggesstion is if you need this plugin stick to cordova 4.x for now
@wf9a5m75 do you have any idea of when this might be available to use for cordova 5.0.0? Thanks!
I'm also running Cordova 5.0.0 with android project 4 and require an update ASAP.
There a many changes currently, and @wf9a5m75 is very busy at the moment. We need to be patient right now till he find the time to upgrade the plugin for compatibillity
Hey guys lets help @wf9a5m75 with the update, is an Open Source project, he doesn't need to have all the responsibility to update it.
The ScrollEvent is deprecated, see here:
https://github.com/apache/cordova-android/commit/581252febc2ca8c2ecbe7077047a34aae0ab25b5
webView.getParent() maybe this help, is from AppGyver about this plugin too.
https://github.com/AppGyver/steroids/issues/588
CordovaWebView in Android v4 is an implementation file, and the implementation is in CordovaWebViewImp and it doesn't extend WebView anymore so the getParent method is not available.
But they are using it like: engine.getView().getParent();.
engine is https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java that is working as a glue between the real WebView, the getView() method returns the webView instance.
I think that probably the other methods are the same because the WebView methods are not available anymore directly in CordovaWebView.
Hope this help.
Hey @leandroz I'm totally on board with working to make the changes you suggest. Have you opened a fork for the issue? I'm happy to help work on it though I don't have _too_ much spare time.
I think I have working code to do the job the ScrollEvent was doing, though maybe if we don't actually have a webView in CordovaWebView, ViewTreeObserver might not work correctly...
Basically it's like this:
final ViewTreeObserver.OnScrollChangedListener scrollListener = new ViewTreeObserver.OnScrollChangedListener() {
// @Override
public void onScrollChanged(int l, int t, int oldl, int oldt) {
if (mPluginLayout != null) {
mPluginLayout.scrollTo(oldl, oldt);
if (mapDivLayoutJSON != null) {
try {
float divW = contentToView(mapDivLayoutJSON.getLong("width"));
float divH = contentToView(mapDivLayoutJSON.getLong("height"));
float divLeft = contentToView(mapDivLayoutJSON.getLong("left"));
float divTop = contentToView(mapDivLayoutJSON.getLong("top"));
mPluginLayout.setDrawingRect(
divLeft,
divTop - oldt,
divLeft + divW,
divTop + divH - oldt);
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}
};
Also I couldn't figure out where to stick that piece of code...
Hello to everybody, I've the same issue.
I have few questions:
How can I downgrade to Apache Cordova 4.x?
I'm using Ionic framework, are they incompatibilities to do the downgrade?
Are there future plans to upgrade this plugin?
Thanks in advance, sorry to bother you.
Hi @Davide95, downgrading is very simple using npm. Simply run the command in your shell:
npm install -g [email protected]
Then if you have projects that have been upgraded to use [email protected]—the new, as-yet-incompatible android version—navigate to their root project directories where the www is located and run
cordova platform update [email protected]
Hi everyone,
has there been any progress on updating this issue for cordova 5.0.0 ?
Thanks
Hi, there is this but I've never tried it
Let me know if it works :)
Hi Davide95,
Yup, it works. I manage to build the app, and run it on Android.
I cannot say if there are any side-effects because this is the first time we are running this on Android, and also we are still in the testing phase of using this plugin.
For now, I'll simply state that it works.
What would be the next steps for getting this merged ?
Thanks
Downgraded :(
+1 for this issue
The problem appears only when it is built for android? Or iOs has the same problem?
Android when bumped to version 4.0
iOS doesn't have this but they didn't bump to version 4.0 yet.
Sorry but I've not understood. I've cordova 5, so I can't use it for iOs?
Cordova team split their CLI version (5.0) and their platform versions.
Check it out here
Android (4.0)
https://github.com/apache/cordova-android/releases
iOS (3.8.0)
https://github.com/apache/cordova-ios/releases
CLI (5.0)
https://github.com/apache/cordova-cli/releases
When iOS version 4.0 is released, it might have breaking changes, but that
hasn't happened yet, so only Android has breaking changes as of now.
On Mon, May 25, 2015 at 8:27 PM, Davide Riva [email protected]
wrote:
Sorry but I've not understood. I ve cordova 5, so I can't use it for iOs?
—
Reply to this email directly or view it on GitHub
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/512#issuecomment-105273963
.
Dor Tzur
Phone: +972.54.7421313
LinkedIn: http://www.linkedin.com/in/dortzur
Facebook: _https://www.facebook.com/dortzur1
https://www.facebook.com/dortzur1_
Thank you so much!
Thank you for this awesome plugin ;)
On Mon, May 25, 2015 at 11:17 PM, Davide Riva [email protected]
wrote:
Thank you so much!
—
Reply to this email directly or view it on GitHub
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/512#issuecomment-105305519
.
Dor Tzur
Phone: +972.54.7421313
LinkedIn: http://www.linkedin.com/in/dortzur
Facebook: _https://www.facebook.com/dortzur1
https://www.facebook.com/dortzur1_
I am not the author, he is @wf9a5m75 :)
Hey I'm late to this a bit, but looking at the https://github.com/Nipher/phonegap-googlemaps-plugin branch they don't re-implement the scrollevent system that was removed in cordova 5/cordova-android 4 so the onScrollEvent won't work I think.
I've tried both maps plugins and I'm still stuck with this atrocious error. Did anyone figure out a solution at all? I'm supposed to have a new APK by tomorrow.
Cordova CLI: 5.1.1
Ionic Version: 1.0.0-rc.2
Ionic CLI Version: 1.5.2
Ionic App Lib Version: 0.2.0
ios-deploy version: Not installed
ios-sim version: 3.1.1
OS: Mac OS X Yosemite
Node Version: v0.12.1
Xcode version: Xcode 6.3.1 Build version 6D1002
@jacksonkr as mentioned above, if you need this for tomorrow the only solution is to downgrade Cordova to 4.x.x
@codebling believe me I've been up and down this thread several times. Your suggestion definitely works for getting maps working again but it disables the whitelist plugin. I know that yesterday before this started happening that I was able to build android with both google maps and whitelist. I'm just going to have to uninstall whitelist (needed) until maps is fixed.
EDIT
I continued to scour around with upgrading/downgrading versions of ionic/cordova. I can't remember all the steps but here's what I remember vaguely:
$ sudo npm -g install [email protected]
$ cordova plugin remove cordova-plugin-whitelist
$ ionic build android
$ sudo npm -g install cordova
$ ionic plugin add cordova-plugin-whitelist
$ cordova platform update android
$ ionic plugin add cordova-plugin-whitelist
$ ionic build android (success - ran from eclipse and validated maps working)
$ cordova plugin list
$ ionic build android (failed - read my note below)
$ ionic info
Your system information:
Cordova CLI: 5.1.1
Ionic Version: 1.0.0-rc.2
Ionic CLI Version: 1.5.0
Ionic App Lib Version: 0.1.0
ios-deploy version: Not installed
ios-sim version: 3.1.1
OS: Mac OS X Yosemite
Node Version: v0.12.1
Xcode version: Xcode 6.3.1 Build version 6D1002
Note: I was only able to get one build and then the following showed up:
$ ionic build android
...
:processDebugResources/Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/res/debug/values/values.xml:2: error: Error parsing XML: prefix must not be bound to one of the reserved namespace names
FAILED
FAILURE: Build failed with an exception.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/Jackson/.android/build-tools/21.1.2/aapt package -f --no-crunch -I /Users/Jackson/.android/platforms/android-22/android.jar -M /Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/res/debug -A /Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/assets/debug -m -J /Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/generated/source/r/debug -F /Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.mediajackagency.m2for1.discountnetwork -0 apk --output-text-symbols /Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/symbols/debug
Error Code:
1
Output:
/Users/Jackson/Sites/Discount Network/2for1/platforms/android/build/intermediates/res/debug/values/values.xml:2: error: Error parsing XML: prefix must not be bound to one of the reserved namespace names
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.683 secs
/Users/Jackson/Sites/Discount Network/2for1/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/Jackson/Sites/Discount Network/2for1/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/Jackson/Sites/Discount Network/2for1/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/Jackson/Sites/Discount Network/2for1/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/Jackson/Sites/Discount Network/2for1/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
* EDIT 2 *
SOLVED (kind of) This will allow you ONE clean build:
cordova plugins remove cordova-plugin-whitelist
cordova platforms remove android
sudo npm -g install [email protected]
ionic build android (fails but the idea is to build the android cache)
sudo npm -g install cordova
cordova platform upgrade android
cordova plugins add cordova-plugin-whitelist
That gives me one clean build in cordova 5.1.1 with maps working. Building after that fails every time until I rinse and repeat.
Even Cordova 4.3.1 build is failing for me. If I remove the plugin it works fine. I tried 3.x.x too.
I've gotten through several errors to get here, such as installing ant, setting PATH variables and installing correct SDK version, but seem to be stuck on what to do from here. Any suggestions? Thanks!
Here's the error in 4.3.1:
BUILD FAILED
/Users/nickstevens/Library/Android/sdk/tools/ant/build.xml:716: The following error occurred while executing this line:
/Users/nickstevens/Library/Android/sdk/tools/ant/build.xml:730: Compile failed; see the compiler error output for details.
Total time: 3 seconds
/Users/nickstevens/Sites/postly_mobile/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: ant with args: debug,-f,/Users/nickstevens/Sites/postly_mobile/platforms/android/build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-gen
ERROR building one of the platforms: Error: /Users/nickstevens/Sites/postly_mobile/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/nickstevens/Sites/postly_mobile/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/Users/nickstevens/.nvm/v0.10.38/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
Hi all,
I found a solution that worked for me to build with cordova 5.1.1
Link to solution: https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/576
Hey!
http://www.java2s.com/Open-Source/Android_Free_Code/PhoneGap/Cordova/org_apache_cordovaScrollEvent_java.htm
What about using it as a hotfix (instead of org.apache.cordova.ScrollEvent) ?

cordova 5.0.0
plugin.google.maps 1.2.5
Windows 7 Home Premium x64
node v0.10.38
I simply added class ScrollEvent to the GoogleMaps.java (like in #576)
fixed in master (Version 1.2.7 and newer). Please reinstall.
Most helpful comment
Hey guys lets help @wf9a5m75 with the update, is an Open Source project, he doesn't need to have all the responsibility to update it.
The ScrollEvent is deprecated, see here:
https://github.com/apache/cordova-android/commit/581252febc2ca8c2ecbe7077047a34aae0ab25b5
webView.getParent() maybe this help, is from AppGyver about this plugin too.
https://github.com/AppGyver/steroids/issues/588
CordovaWebView in Android v4 is an implementation file, and the implementation is in CordovaWebViewImp and it doesn't extend WebView anymore so the getParent method is not available.
But they are using it like:
engine.getView().getParent();.engine is https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java that is working as a glue between the real WebView, the
getView()method returns the webView instance.I think that probably the other methods are the same because the WebView methods are not available anymore directly in CordovaWebView.
Hope this help.