I'm trying to use reverse geocoding in Android but am getting the following error in the LogCat Console.
10-24 21:37:41.284 18809-18897/app.com E/CordovaLog: An error occurred
java.lang.NoSuchMethodException: geocode [class org.json.JSONArray, class org.apache.cordova.CallbackContext]
at java.lang.Class.getMethod(Class.java:624)
at java.lang.Class.getDeclaredMethod(Class.java:586)
at plugin.google.maps.MyGeocoder.execute(MyGeocoder.java:27)
at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:95)
at org.apache.cordova.PluginManager.exec(PluginManager.java:130)
at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
at org.crosswalk.engine.XWalkExposedJsApi.exec(XWalkExposedJsApi.java:40)
at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:37)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
10-24 21:37:41.284 18809-18897/app.com W/CordovaPlugin: Attempted to send a second callback for ID: Geocoder617582612
Result was: "Invalid action"
This is the error I get in Log cat. The success callback is fired, but the results comeback empty every time. Any idea what could be causing this issue? Heres the request. I'm using version 1.3.9 (cant upgrade to 1.4.0).
window.plugin.google.maps.Geocoder.geocode({ position: { lat: '38.996347', lng: '-77.02918' } }, function (results) {
console.log('success', results.length);
}, function () {
console.log('fail');
});
Thanks for your help!
Does this happen if you reinstall the plugin?
The current version will be deprecated soon.
Please use the v2-beta version.
https://github.com/mapsplugin/cordova-plugin-googlemaps#version-20-beta
Thanks @wf9a5m75 . I actually just figured it out, had to add the following toa proguard-rules file in the project. Thanks for your quick reply!
#Google Maps Rules
-keep class plugin.google.maps.** { *; }
Most helpful comment
Thanks @wf9a5m75 . I actually just figured it out, had to add the following toa proguard-rules file in the project. Thanks for your quick reply!