Android Question use kvs db from 2 different projects?

ilan

Expert
Licensed User
Longtime User
hi

i am creating in one of my projects a db via key value store.
now i would like to import all data from that db to another b4a project (different package name)

but i get an error:

** Activity (main) Resume **
conallshift.db
codemodule started
בוקר|480|100|120|125|120|150|שישי|180|100|120|125|120|150|לילה|720|150|-1|-1|-1|-1|
Class not found: www.sagitalcashlite.net.converttonewsalary$_shift, trying: www.sagital.mysalarynew.converttonewsalary$_shift
Error occurred on line: 56 (KeyValueStore)
java.lang.RuntimeException: java.lang.ClassNotFoundException: www.sagital.mysalarynew.converttonewsalary$_shift
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:297)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readObject(B4XSerializator.java:357)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ReadObject(B4XSerializator.java:112)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.ConvertBytesToObject(B4XSerializator.java:82)
at www.sagital.mysalarynew.keyvaluestore._get(keyvaluestore.java:116)
at www.sagital.mysalarynew.keyvaluestore._fillarraymap(keyvaluestore.java:295)
at www.sagital.mysalarynew.keyvaluestore._initialize(keyvaluestore.java:205)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:19)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1654)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.ClassNotFoundException: www.sagital.mysalarynew.converttonewsalary$_shift
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:324)
at java.lang.Class.forName(Class.java:285)
at anywheresoftware.b4a.randomaccessfile.RandomAccessFile.readTypeClass(RandomAccessFile.java:562)
at anywheresoftware.b4a.randomaccessfile.B4XSerializator.readType(B4XSerializator.java:274)
... 23 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "www.sagital.mysalarynew.converttonewsalary$_shift" on path: DexPathList[[zip file "/data/app/www.sagital.mysalarynew-1/base.apk"],nativeLibraryDirectories=[/data/app/www.sagital.mysalarynew-1/lib/arm, /data/app/www.sagital.mysalarynew-1/base.apk!/lib/armeabi, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 28 more
Suppressed: java.lang.ClassNotFoundException: www.sagital.mysalarynew.converttonewsalary$_shift
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 29 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

this is the codemodule from the other project (where i create the db)

Class not found: www.sagitalcashlite.net.converttonewsalary$_shift, trying:

is it stored inside the file and only that project can open it ??

thanx, ilan
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User

i am not sure this is what i need.

both app are installed on my device.

i have just created a new App (like mytools1 and now i have mytools2)
now i want the user to be able to export all data from mytools1 to mytools2

the only problem is that in the first app i used a different approach to save all data so i created a codemodule and i am now creating a key value store db in the first app and now i would like to import all data from that db to the new app. (the new app is already working with key value store)
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Upvote 0

ilan

Expert
Licensed User
Longtime User
actually the error happens here:

B4X:
result = ser.ConvertBytesToObject(rs.GetBlob2(0))

this is the whole code of the sub

B4X:
Public Sub Get(Key As String) As Object
    Dim rs As ResultSet = sql1.ExecQuery2("SELECT value FROM main WHERE key = ?", Array As String(Key))
    Dim result As Object = Null
    If rs.NextRow Then
        result = ser.ConvertBytesToObject(rs.GetBlob2(0))
    End If
    rs.Close
    Return result
End Sub
 
Upvote 0
Top