2
votes

I am making an app on codename one using the google maps API. I added the google maps extension and build hints. When I run the program I get an error on the line where I created the MapContainer like so.

cnt = new MapContainer("API KEY");

The full error is this:

java.lang.NoClassDefFoundError: com/codename1/googlemaps/InternalNativeMaps
    at com.codename1.googlemaps.MapContainer.<init>(MapContainer.java:194)
    at com.codename1.googlemaps.MapContainer.<init>(MapContainer.java:163)
    at milton.app.MyApplication.start(MyApplication.java:80)
    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 com.codename1.impl.javase.Executor$3$1.run(Executor.java:256)
    at com.codename1.ui.Display.processSerialCalls(Display.java:1238)
    at com.codename1.ui.Display.mainEDTLoop(Display.java:1033)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
Caused by: java.lang.ClassNotFoundException: com.codename1.googlemaps.InternalNativeMaps
    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:1004)
    at com.codename1.impl.javase.ClassPathLoader.findClass(ClassPathLoader.java:105)
    at com.codename1.impl.javase.ClassPathLoader.loadClass(ClassPathLoader.java:55)
    ... 12 more

There is also something wrong with the MapContainer.java file. It says that

Library source code does not matchthe bytecode for the class MapContainer

I have created multiple new projects to make sure there was not a problem with my build hints or any other typo but I still I am getting the same error. Please help.

1
You didn't mention the IDE, which is a crucial piece of information. - Shai Almog
Sorry, I am working on InteliJ - Max Litvak

1 Answers

0
votes

Is your plugin up to date and did you invoke refresh libs?

Try sending a build once, this should trigger the ant build and should copy the JavaSE port code to the right library.

The Java source isn't wrong. It's stubs which is what we do for JavaDoc completion. We should/could make this change to the library build process but never did do that: https://www.codenameone.com/blog/open-source-cn1libs.html