B4J Question KeyValueStore (b4xlib) - Error

jmon

Well-Known Member
Licensed User
Longtime User
Hello,

I upgraded my application to use the new KeyValueStore.b4xlib. I was previously using kvs2.

I get this error now:

B4X:
B4J Version: 9.80
Parsing code.    (0.51s)
    Java Version: 14
Building folders structure.    (0.08s)
Compiling code.    (0.70s)
Compiling layouts code.    (0.01s)
Organizing libraries.    (0.00s)
Compiling generated Java code.    Error
B4J line: 87
End Sub
Picked up _JAVA_OPTIONS: -Xms1024m -Xmx2048m
src\com\xxxx\xxxxx\keyvaluestore.java:282: error: cannot find symbol
     {return ((anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) Debug.delegate(ba, "getmapasync", new Object[] {parent._keys}));}
                                                                                                                         ^
  symbol:   variable parent
  location: class keyvaluestore

I've also updated b4j, and using the newest JDK 14, but I can't figure out how to solve this. Also I'm not sure how to edit or look into b4xlib files?
 

teddybear

Well-Known Member
Licensed User
I read your previous post and this post, if you just would like to get keyslist, the simplest way is that put keys into a text file using FILE.WriteList, and then read them using FILE.ReadList
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I get this error now:

W/o seeing all the code, it's not quite clear what is going on. Why don't you post a sample app that reproduces this issue?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I've also updated b4j, and using the newest JDK 14, but I can't figure out how to solve this. Also I'm not sure how to edit or look into b4xlib files?

Seems to work fine. Using B4J 9.80, Java 11, and Java 14 (both provided by @Erel). I'm attaching my rudimentary test project.
 

Attachments

  • KVSTest.zip
    8.9 KB · Views: 156
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
A *.b4xlib library file can be unzipped and the code is in *.bas files.
You can also use this tool: B4XSources
The error might be related to debug mode (Debug.delegate(... ).
Do you have the same error in Release mode?
Thank you for your help. Yes I also get the error in release:

B4X:
src\com\jmon\myapp\keyvaluestore.java:166: error: cannot find symbol
ResumableSub_GetMapAsync rsub = new ResumableSub_GetMapAsync(this,parent._keys);
                                                                  ^
  symbol:   variable parent
  location: class keyvaluestore
 
Upvote 0

jmon

Well-Known Member
Licensed User
Longtime User
Seems to work fine. Using B4J 9.80, Java 11, and Java 14 (both provided by @Erel). I'm attaching my rudimentary test project.
Thanks, it was also working for me in example apps, but I get this error in my "old" app. I've been using KVS2 for a long time, and wanted to update it. Actually yesterday I found that the version of KVS I was using wasn't closing a resultset, and I found out about this new version of KVS., thinking it would be better to update. I removed all references to the old KVS2, and updated the app to use the new methods of KVS (the new one).

I cannot find a way to reproduce this error on another small example. I've tried "normal" old UI apps, and B4xPages, it works on both. I just get the error on the application I wanted to update.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I cannot find a way to reproduce this error on another small example. I've tried "normal" old UI apps, and B4xPages, it works on both. I just get the error on the application I wanted to update.
Are you sure you are not accidentally including another file that includes KVS functionality? The b4xlib that I use shows version 2.31 for KeyValueStore in the Labraries Manager tab. Looking at the produced keyvaluestore.java, line 282 is

Java:
        switch (state) {

The line that is similar to your error message shows up at line 251 (I'm showing 250 and 251 below)
Java:
if (Debug.shouldDelegate(ba, "getmapasync", true))
     {return ((anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) Debug.delegate(ba, "getmapasync", new Object[] {_keys}));}
(Note: it's just _keys here, not parent._keys)
 
Upvote 0
Top