I was using the Codename Google Maps plugin with Eclipse. I added GoogleMaps.cn1lib to my lib and did Menu -> CodeNameOne -> Refresh Libs.
the code looks like :
Form hi = new Form("Hi World");
hi.addComponent(new Label("Hi World"));
MapContainer googleMap = new MapContainer();
hi.add(googleMap);
hi.show();
I have edited properties file and added the props as per instructions (replacing API keys where needed)
I have generated Google API keys and get the following exception when running the simulator. The app fails to the open street maps.
in my lib/impl/native/android I can see the source code in InternalNativeMapsImp.java for Android.
java.lang.ClassNotFoundException: com.codename1.googlemaps.InternalNativeMapsImpl
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1001)
at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:100)
at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:50)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.codename1.system.NativeLookup.create(NativeLookup.java:61)
at com.codename1.googlemaps.MapContainer.<init>(MapContainer.java:116)
at com.codename1.googlemaps.MapContainer.<init>(MapContainer.java:81)
I have changed IDE from Eclipse/Net Beans - same thing
and on iOS build fails with the same reason, just before the stack trace I have:
Executing: javac -classpath /var/folders/p7/xxx/classes -d /var/folders/p7/xxx/seVer /var/folders/p7/xxx/stub/com/codename1/googlemaps/InternalNativeMapsImplCodenameOne.java /var/folders/p7/xxx/stub/com/codename1/googlemaps/InternalNativeMapsStub.java /var/folders/p7/xxx/stub/GooglrMapsStub.java Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.
How can I add the source of MapContainer to debug ?
Google / Native Maps is currently available on real devices and not on simulator.
Showing openstreetmap is the default and correct behaviour, but the exception shouldn't be thrown. How are you creating your Map? The simple and right way is:
MapContainer googleMap = new MapContainer();
f.add(BorderLayout.CENTER, googleMap);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With