NoSuchMethodError No Direct Method

41 views
Skip to first unread message

Gareth Murfin

unread,
Aug 27, 2019, 4:30:11 PM8/27/19
to CodenameOne Discussions
I compiled and sent this project to the server https://github.com/chen-fishbein/bluetoothle-codenameone/tree/master/BTDemo

It runs fine but when I tap "initialise" I get this error

"no such method error, no direct method java/util/map in class ca/weblite/codename1/json/JSonObject

Any ideas?

Gareth Murfin

unread,
Aug 27, 2019, 5:13:24 PM8/27/19
to CodenameOne Discussions
Seems like it should be due to no json lib, but its there, then I realised it was only 30k somehow soI grabbed it from here

https://github.com/codenameone/CodenameOneLibs/tree/master/cn1libs

that one was 85k... but now it wont compile  (complains that it cannot find ca.weblite.codename1.json.JSONObject; ) , even after doing refresh cn1 libs. I cannot work out whats going wrong ive used the json lib hundreds of times with no issue.

Gareth Murfin

unread,
Aug 27, 2019, 6:26:04 PM8/27/19
to CodenameOne Discussions
oh I forgot to delete the folder in the libs dir, I think that was why, all good now. 

Gareth Murfin

unread,
Aug 27, 2019, 7:35:31 PM8/27/19
to CodenameOne Discussions
actually on the device im still getting the error, im very confused right now, any thoughts??

 Exception: java.lang.NoSuchMethodError - No direct method <init>(Ljava/util/Map;)V in class Lca/weblite/codename1/json/JSONObject; or its super classes (declaration of 'ca.weblite.codename1.json.JSONObject' appears in /data/app/com.pippa.hobmonitor-i555BGum4BjW27o1gIXtCQ==/base.apk)
W/System.err: java.lang.NoSuchMethodError: No direct method <init>(Ljava/util/Map;)V in class Lca/weblite/codename1/json/JSONObject; or its super classes (declaration of 'ca.weblite.codename1.json.JSONObject' appears in /data/app/com.pippa.hobmonitor-i555BGum4BjW27o1gIXtCQ==/base.apk)

Gareth Murfin

unread,
Aug 28, 2019, 8:32:17 AM8/28/19
to CodenameOne Discussions
Im starting a contract today coding bluetooth in codenameone, so hopefully someone can help in some way!!

Kandy Bitxenio

unread,
Aug 28, 2019, 8:49:26 AM8/28/19
to CodenameOne Discussions
Hi Garet

I used the BlueThooh codename one lib and didn't have any problem. The project work fine for me. I added the BT and Json Required Libraries from Codename One Settings (libs option).

This are my libs size

C:\dev\eclipseOxigen\OxigenApp\lib>ls -la
total 18736
drwxrwxrwx   1 user     group           0 Jul  3 20:47 .
drwxrwxrwx   1 user     group           0 Jul  3 20:47 ..
-rw-rw-rw-   1 user     group       12380 Jul  3 20:47 AnimatedGifSupport.cn1lib
-rw-rw-rw-   1 user     group          10 Jul  3 20:47 AnimatedGifSupport.ver
-rw-rw-rw-   1 user     group     2264815 Jul  3 20:47 CLDC11.jar
-rw-rw-rw-   1 user     group       46807 Jul  3 20:47 CN1Bluetooth.cn1lib
-rw-rw-rw-   1 user     group          10 Jul  3 20:47 CN1Bluetooth.ver
-rw-rw-rw-   1 user     group       30564 Jul  3 20:47 CN1JSON.cn1lib
-rw-rw-rw-   1 user     group          10 Jul  3 20:47 CN1JSON.ver
-rw-rw-rw-   1 user     group     6129031 Jul  8 12:36 CodenameOne.jar
-rw-rw-rw-   1 user     group    10695991 Jul  8 12:36 CodenameOne_SRC.zip
drwxrwxrwx   1 user     group           0 Jul  3 20:47 impl



Best Regards Kandy

Gareth Murfin

unread,
Aug 28, 2019, 9:06:03 AM8/28/19
to CodenameOne Discussions
Thanks very much for your reply Kandy.

They look similar (though) not exactly the same as mine.. where did you get CN1Bluetooth.cn1lib from? im using theirs which as you can see has a spelling mistake, so yours might be different?

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       28/08/2019     14:03                impl
-a----       27/08/2019     20:46        2264815 CLDC11.jar
-a----       27/08/2019     21:46          50396 CN1Bluethooth.cn1lib
-a----       14/08/2017     10:44          30533 CN1JSON.cn1lib
-a----       27/08/2019     21:19        6256001 CodenameOne.jar
-a----       27/08/2019     21:19       10888836 CodenameOne_SRC.zip

Kandy Bitxenio

unread,
Aug 28, 2019, 9:13:32 AM8/28/19
to CodenameOne Discussions
Hi Gareht

You haven´t all the required libs, You must import the Json CN1JSON.cn1lib.

I recomended you, clean your libs and reimport it.

I importd directly from codenameOne Preferences, I use Eclipse. Whai Ide you use?

Just see this links:


Best Regards Kandy

Gareth Murfin

unread,
Aug 28, 2019, 9:20:21 AM8/28/19
to CodenameOne Discussions
I do have that library if you look carefully. I have tried cleaning and reimporting many times... seems ok on the emulator (ie json lib works) but on phone it always has that error.  

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/cRobfgvwT38/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/28059ec0-8818-4b88-9c23-b12260924431%40googlegroups.com.


--
Gareth Murfin
(Android Freelancer - www.garethmurfin.co.uk)

Shai Almog

unread,
Aug 28, 2019, 10:36:12 PM8/28/19
to CodenameOne Discussions
Notice that there is more than one json lib...

Gareth Murfin

unread,
Aug 29, 2019, 11:08:32 AM8/29/19
to CodenameOne Discussions
That's confusing. Weirdly I was trying to make a change to the bluetooth lib but then when I try to use it I get the same error. about missing method etc...once i compile it. hair tearing madness.

Thomas

unread,
Aug 29, 2019, 12:23:57 PM8/29/19
to CodenameOne Discussions
you probably forgot to click on "Refresh CN1 libs" after replacing the old .cn1lib file in your project with your modified one.
Reply all
Reply to author
Forward
0 new messages