Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"map is null" - Cordova 3.4.1 #51

Closed
schurkecon opened this issue May 13, 2014 · 12 comments
Closed

"map is null" - Cordova 3.4.1 #51

schurkecon opened this issue May 13, 2014 · 12 comments
Labels
Milestone

Comments

@schurkecon
Copy link

Hi,
Thanks for working on this plugin.

If it is okay to ask the question here, I just wanted to know what might be the problem why my app is triggering "map is null!" error.

I'm using Cordova, im running it on Windows 7, I use both CLI and Eclipse in my project.

I followed the Automatic Installation procedure, added the plugin using the CLI, and made sure to apply the API key provided by Google (SHA1 added). I check my AndroidManifest.xml, and the plugin is there, the API Key is also there. I want to know why it is triggering the "map is null" error so I can also narrow down the possible solutions.

Thanks again for this wonderful plugin!

@TheMassassian
Copy link

I have the same problem, followed the tutorial step by step. The App is working on iOS devices but not on Android devices(also not on the emulator). I'm using MacOS 10.9.2, CLI & Eclipse.

@jskidd3
Copy link

jskidd3 commented May 13, 2014

I can also confirm that I had this problem when testing my app on an Android device.

@stooj
Copy link

stooj commented May 13, 2014

I am experiencing the same issue with the android emulator, after following the tutorial. I configured weinre to have a look under the hood.
When I run the js manually, I get the following error:

Java Error
The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4323000 but found 4323030.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

There is also an empty

tag created in the header, but I'm not sure if that is weinre or the maps plugin.

@wf9a5m75
Copy link
Member

This issues occurs especially on Android emulator, because Google Maps Android API v2 uses Google Play Services library which provides as isolated APK.
https://play.google.com/store/apps/details?id=com.google.android.gms

And the error of @stooj means you need to update the Google Play Services.
I point the plugin to the latest version of the Google Play Services, so please update it, then should be solved.

@wf9a5m75
Copy link
Member

For more detail, refer the stack overflow
Running Google Maps v2 on the Android emulator

@stooj
Copy link

stooj commented May 13, 2014

Is the version numbering unpredictable?
4323000 < 4323030, so I assumed I was running a later version than required.

@wf9a5m75
Copy link
Member

Ok, temporally solution.
(1) Change the version 4323000 in the platforms/android/res/values/version.xml
(2) Comment out the line the below lines:

Line 108
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/0509525c3dcbc5d946dd182d8c84c1cfd46de9ca/src/android/plugin/google/maps/GoogleMaps.java#L108

Line 309
https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/0509525c3dcbc5d946dd182d8c84c1cfd46de9ca/src/android/plugin/google/maps/GoogleMaps.java#L309

(3) Don't use map.getMyLocation()

The google-play-services.jar is something wrong.

@schurkecon
Copy link
Author

Thanks for your response.
I tried your temporary solutions number 2 and 3.

These are the test results using the instructions from the Automatic installation page:

When running the app, the map will not load and a "Java Error null" will prompt.
When I click the Full Screen button, the map will successfully load.

Thanks and I am looking forward for your future solutions.

@wf9a5m75
Copy link
Member

@schurkecon Sorry for inconvenience.

@schurkecon
Copy link
Author

@wf9a5m75 It's okay, you have a great plugin.
Your plugin is much more faster than the javascript API. Thanks. I hope we can use it soon.

@wf9a5m75
Copy link
Member

This issue will be fixed in v1.0.12

@wf9a5m75 wf9a5m75 added this to the v1.0.12 milestone May 16, 2014
wf9a5m75 added a commit that referenced this issue May 17, 2014
Prevent the "map is null" dialog even if the device does not have Google Play Services
@wf9a5m75
Copy link
Member

I released the plugin version 1.1.0 (old version name v1.0.12). Please uninstall the plugin, then install it again.

wf9a5m75 added a commit that referenced this issue Mar 1, 2015
Prevent the "map is null" dialog even if the device does not have Google Play Services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants