Android Question With new library I got - library .so not found

petr4ppc

Well-Known Member
Licensed User
Longtime User
Hallo, please,

I put to my project new library, but I got error -
java.lang.UnsatisfiedLinkError: dlopen failed: library "libpocketsphinx_jni.so" not found

I found on the forum - Maybe solution? Is this best solution?

Please, can you give me advice what is the best way how to solve it? I am using Java 11.
Thank you and best regards
p4ppc
 

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends, Mr. Erel,

I have read forum. But I not understand how can I solve it or if it is possible to solve my situation, because

If I am using Library nr.1 alone, then everything is perfect.
In my project code I am not using code such this:
B4X:
System.load(File.Combine(File.getDirDefaultExternal(), "xxxxxxxxx.so"));

If I am using Library nr.2 alone, then everything is perfect.
In my project code I am not using code such this:
B4X:
System.load(File.Combine(File.getDirDefaultExternal(), "xxxxxxxxx.so"));

If I am using Library nr.1 alone and I add to same project Library Nr.2 (if I am working with Nr1 and Nr2 together), then I get desribed error:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libpocketsphinx_jni.so" not found

Please I understand right that both Libraries contains code
B4X:
System.load(File.Combine(File.getDirDefaultExternal(), "xxxxxxxxx.so"));
and I must change this code inside Libraries?
How can I do it, please?

Best regards,
p4ppc
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
If each lib works separately but not both at the same time, it's possible that the problem is similar to what happened HERE

Can you unzip the 2 jars and report which folders do there exist under the 'lib' folder?
 
Upvote 0

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear JordiCP,

thank you very much for advice.
I have unziped both jars.

1) In lib folder od first one library is:
arm64-v8a and armeabi-v7a folder
2) In lib folder of second one library is:
armeabi and armeabi-v7a folder

So in both libraries is same folder: armeabi-v7a

What can I do, please?
Best regards
p4ppc
 
Upvote 0

JordiCP

Expert
Licensed User
Longtime User
Not sure, but as a quick test please try
  1. Keep a copy of the original jars in a safe folder
  2. Delete the arm64-v8a folder from the first lib, zip it again (and rename it to .jar)
  3. Place the modified library where it was (additional libraries folder, or the path where they were found)
  4. Build the project again and see if the same error persists

If i works, both loaded .so files will be 32-bits (armeabi-v7a). So, if the app is for private distribution, I guess it will be enough.

Contrarily, if the app needs to be available in Google Play, it is compulsory to provide 64-bit support. So, the only way, instead of the above, would be to find a version for the second lib which includes 64-bit native binaries (i.e, the arm64-v8a folder)
 
Upvote 0

petr4ppc

Well-Known Member
Licensed User
Longtime User
JordiCP,

thank you for advice,
Now I see in B4A window:
zip END header not found
I am looking for same situation in B4J community , but I see only one example and this is not like my situation. Please what can I do?
Best regards
p4ppc
 
Upvote 0
Top