Android Question Compile To Library Alt+5 How to include JSON file in library

jimmyF

Active Member
Licensed User
I have created my first library with the "Compile To Library" command.
I make use of the B4XPreferenceDialog in the Class modules.

Actually, the log error is the following:
B4X:
Initialize: java.io.FileNotFoundException: /data/user/0/sef.test/files/virtual_assets/listtemplate.bal (No such file or directory)
This is not a file that I use.

btw, there was nothing found in my forum searches.
 
Last edited:

jimmyF

Active Member
Licensed User
So, I am trying to load this file (I can see it in the jar(zip) file.):
B4X:
prefdialog.LoadFromJson(File.ReadString(File.DirAssets, "login.json"))
I have tried this but it tells me it is missing a parameter.

B4X:
Dim sFile As String = File.DirAssets &  "login.json"
prefdialog.LoadFromJson(File.ReadString(jf1.LoadFileFileFromJar(sFile)))
 

jimmyF

Active Member
Licensed User
Dim sFile As String = "login.json"
prefdialog.LoadFromJson(jf1.LoadFileFileFromJar(sFile))
When jf1.Initialize(True):
java.lang.RuntimeException: JSON Object expected.

When jf1.Initialize(False):
Too many errors with the loading of the B4XPreferencesDialog.

I will drop this idea of compiling it into a library and simply use the classes I wrote directly in my apps.
That way they work just fine.

Many thanks for your help.

-j
 
Top