Open craig-at-rsg opened 2 years ago
Also having this issue after upgrading to cordova 10.
Also having this issue. Any sugerency...
I am also using Cordova 10 targeting 31 but for me it works. I wonder if this has to do with custom markers?
I am also using Cordova 10 targeting 31 but does not for me it works .i can only see white screen and can u plz share me your sample code and when building did u get any issues regarding
I am also using Cordova 10 targeting 31 but does not for me it works .i can only see white screen and can u plz share me your sample code and when building did u get any issues regarding
Will do. Give me a day or two. Currently traveling. Did you test it with an actual device? What Android version is the device?
But I did test it with the simulator as well on every Android version and it worked. What does the simulator do for you?
I am also using Cordova 10 targeting 31 but does not for me it works .i can only see white screen and can u plz share me your sample code and when building did u get any issues regarding
Will do. Give me a day or two. Currently traveling. Did you test it with an actual device? What Android version is the device?
But I did test it with the simulator as well on every Android version and it worked. What does the simulator do for you?
Thanks for reply . I uninstalled the current one and installed this ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps.git#0b8ea76ad34fb2a202a9de1b9d0e051a82ad9443
and also installed androidx and androidx-adapter and replace and imported some classes from androidX and androidX adapter that was not found in pluginMap.java file to fix build issue
and then everything worked fine for me Thanks :)
I also have this issue. All works fine on android@9 but when change to android@10 the map do not load any solution for this?
@keev-studio Do you solve your problem ??
I solved the issue by doing below steps
npm i git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#0b8ea76ad34fb2a202a9de1b9d0e051a82ad9443
ionic cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.+ npm i cordova-plugin-android-support-v4 npm i cordova-plugin-androidx-adapter
PluginMap.java PluginLocationService.java
and at the top import section search for PermissionChecker and NonNull and replace that 2 imports with this in both files
import android.support.annotation.NonNull; import android.support.v4.content.PermissionChecker;
Finally remove and add the android platform again and run the projects
after doing this steps u can access the plugins by declaring
declare const window: any;
below imports in ur app.component.ts
file
For eg : To set the google maps key u can do this
this.platform.ready().then(() => {
window.plugin.google.maps.environment.setEnv({
'API_KEY_FOR_BROWSER_RELEASE': '** YOUR MAPS KEY **',
'API_KEY_FOR_BROWSER_DEBUG': ''** YOUR MAPS KEY **' // optional
});
})
I'm also experiencing this issue (map staying blank) after upgrading cordova-android
from 8 to 11.
I debugged the native code and found that the initial call to getMap
is failing ad the following line in CordovaGoogleMaps.java
pluginManager.addService(pluginEntry);
The cause seems to be that pluginEntry
contains a Cordova plugin instance that is already initialized, and the addService
methods attempts to initialize it again This is triggering a Java assert
in CordovaPlugin.java
assert this.cordova == null;
If I build the app for release, the map appears correctly (since assertions are never run in release mode).
The strange thing is that the code was identical in cordova-android@8
, but the assertion was not firing in debug mode.
My guess Is that assertions were previously always disabled in Android and are now enabled thanks to the new Android API/VM.
I'm also experiencing this issue (map staying blank) after upgrading
cordova-android
from 8 to 11. I debugged the native code and found that the initial call togetMap
is failing ad the following line inCordovaGoogleMaps.java
pluginManager.addService(pluginEntry);
The cause seems to be that
pluginEntry
contains a Cordova plugin instance that is already initialized, and theaddService
methods attempts to initialize it again This is triggering a Javaassert
inCordovaPlugin.java
assert this.cordova == null;
If I build the app for release, the map appears correctly (since assertions are never run in release mode).
The strange thing is that the code was identical in
cordova-android@8
, but the assertion was not firing in debug mode. My guess Is that assertions were previously always disabled in Android and are now enabled thanks to the new Android API/VM.
Thanks Lorenzo for your input. Can you please elaborate more on specific changes you did to make the plugin working on Cordova 11. So many people waiting for this I suppose. Thank you
@keev-studio please see this commit on our fork: webratio/phonegap-plugin-googlemaps@66e8d2607e88e0318c750f2c0c6ca1d778907ad4.
The fix for now is very very hacky. Basically I null out the cordova
field, so the Java assertion does not fail. The advantage is that this fix is very safe, since I am not changing the creation and initialization of helper CordovaPlugin
objects.
Ideally, we should fix the problem by not requiring an explicit initialization of the various plugin objects (i.e. calls to privateInitialize
) but that would require larger changes to the GoogleMaps plugin.
Hi, I am sorry it took me so long to implement your solution. Unfortunatelly the map stay blank (do not initialize loading) after using your fork.
@keev-studio Do you solve your problem ??
no, still looking for solution, did you find any?
@keev-studio I guess the plugin is showing some other issue that I didn't encounter. From what I have seen, an exception thrown in the wrong place will interfere with loading the map, and it would just stay blank.
Your best bet is to look at native Android logs. You can try opening your app in Android Studio and building from there, or may using the command adb logcat
while you try opening the map.
@keev-studio I guess the plugin is showing some other issue that I didn't encounter. From what I have seen, an exception thrown in the wrong place will interfere with loading the map, and it would just stay blank.
Your best bet is to look at native Android logs. You can try opening your app in Android Studio and building from there, or may using the command
adb logcat
while you try opening the map.
Hi, thank you for pushing me forward. I am now checking the logcat, but apart of couple of warnings the app does not produce any meaningful errors. Not sure how I can proceed any further. Am I only one trying to run Googlemapss plugin in Cordova 11? These are my errors: Looks like the plugin do not even initialize the connection with Google server? Can this be some SSL issue? These are my warnings
Hello i've been solving this for hours already and i finally resolve the issue.
I solved the issue by doing below steps
- Uninstall currently installed GoogleMaps Plugin and install using this command
npm i git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#0b8ea76ad34fb2a202a9de1b9d0e051a82ad9443
- install these 3 plugins
ionic cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.+ npm i cordova-plugin-android-support-v4 npm i cordova-plugin-androidx-adapter
- After step 2 goto Plugins Folder and inside Plugins-->cordova-plugin-googlemaps-->src-->android-->plugin-->google-->maps. inside this folder there will be many java files, among those files open below 2 files
PluginMap.java PluginLocationService.java
and at the top import section search for PermissionChecker and NonNull and replace that 2 imports with this in both files
import android.support.annotation.NonNull; import android.support.v4.content.PermissionChecker;
Finally remove and add the android platform again and run the projects
Note : in recent versions of ionic android platform there is androidX build in but still i suggest u to install using the above command .
i've tried this and
@keev-studio please see this commit on our fork: webratio/phonegap-plugin-googlemaps@66e8d26.
The fix for now is very very hacky. Basically I null out the
cordova
field, so the Java assertion does not fail. The advantage is that this fix is very safe, since I am not changing the creation and initialization of helperCordovaPlugin
objects.Ideally, we should fix the problem by not requiring an explicit initialization of the various plugin objects (i.e. calls to
privateInitialize
) but that would require larger changes to the GoogleMaps plugin.
this also
mine is now working
I'm submitting a ... (check one with "x")
OS: (check one with "x")
cordova information: (run
$> cordova plugin list
)If you use
@ionic-native/google-maps
, please tell the package.json (only@ionic-native/core
and@ionic-native/google-maps
are fine mostly)Current behavior:
The map doesn't load. I traced the JS code, and it seems to call through to the Java code, but a breakpoint in the Java code shows the CordovaGoogleMaps execute function is not being called. I'm not positive this is relevant, but I do get an info-level log line:
Expected behavior: Map should load
Related code, data or error log (please format your code or data):
I upgraded to cordova-android 10 and I'm targeting the Android SDK 31; those are the changes I made right before this stopped working.
Support this plugin activity
I appreicate if you give me a beer :beer: from here