B4J Question [SOLVED] jGoogleMaps - problem to start of example included

amorosik

Expert
Licensed User
I use this jGoogleMaps tutorial to try visualize a Google Maps on a pc desktop
B4J 8.50, jGoogleMap 1.82, jFX 8.30, jdk1.8.0_241 (also with jdk-11.0.1 is same problem)
When i load example at the bottom of first post and try to execute, a rapid flash show a map, then "Ooops, in not possible to load ...." on the center of form
Nothing appear on log window
if i try to press RESET MAP button, then log display

Log windows:
Waiting for debugger to connect...
Program started.
Alert: loadMapLibrary
mapLibraryLoaded!
Alert: !!!mapLibraryLoaded!!!
Errore nella linea: 65
java.lang.NullPointerException
    at com.lynden.gmapsfx.javascript.object.GoogleMap.internalGetZoom(GoogleMap.java:76)
    at com.lynden.gmapsfx.javascript.object.GoogleMap.zoomProperty(GoogleMap.java:93)
    at com.lynden.gmapsfx.javascript.object.GoogleMap.setZoom(GoogleMap.java:68)
    at anywheresoftware.b4j.googlemaps.GoogleMapWrapper.MoveCamera(GoogleMapWrapper.java:239)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:676)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:240)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
    at anywheresoftware.b4a.BA$1.run(BA.java:216)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
    at java.lang.Thread.run(Thread.java:748)

This if i use the example without modification
If instead of gmap.Initialize("gmap", options) i use gmap.Initialize2("gmap", options,"AIzaSyAGA0N1D............") the same error appear
What can i try to resolve this problem ?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

amorosik

Expert
Licensed User
I discovered problem, it was the api key
I was using an api key that with example for Android worked correctly, obviously for use with the jGoogleMaps library you need another key or you need to enable other api on the Google account
I tried using an alternative api key and now it works fine
 
Upvote 0
Top