Java Question [SOLVED] .so files

Johan Schoeman

Expert
Licensed User
Longtime User
I have a library project set up (for SLC) as follows:

additional
lib
armeabi
2 x .so files​
mips
2 x .so files​
x86
2 x .so files​
armeabi-v7a
2 x.so files​
src
some folders with the wrapper and project being wrapped​
libs
some jar files that need to be included when compiling the project​


In the wrapper I do:
B4X:
@Hide

public void _initialize(BA ba, Object activityClass, String EventName) {
this.eventName = EventName.toLowerCase(BA.cul);
this.ba = ba;
cv = new ZBarScannerView(ba.context);

this.setObject(cv);

addListener();}

private void addListener() {
System.loadLibrary("iconv");
System.loadLibrary("zbarjni");
}


It compiles 100% but when I start the B4A project I get this error:
B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 325)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
at JHS.ZbarBarcodeScanner.main._activity_create(main.java:325)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at JHS.ZbarBarcodeScanner.main.afterFirstLayout(main.java:102)
at JHS.ZbarBarcodeScanner.main.access$000(main.java:17)
at JHS.ZbarBarcodeScanner.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:54)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 17 more
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load iconv from loader dalvik.system.PathClassLoader[dexPath=/data/app/JHS.ZbarBarcodeScanner-15.apk,libraryPath=/data/app-lib/JHS.ZbarBarcodeScanner-15]: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at main.java.me.dm7.barcodescanner.zbar.ZBarScannerView.<clinit>(ZBarScannerView.java:32)
at zbarbarcodescannerwrapper.zbarBarcodeScannerWrapper._initialize(zbarBarcodeScannerWrapper.java:76)
... 21 more

The .so files are named:
libiconv.so
libzbarjni.so

Once the jar has been created I can see the following inside the jar:

lib
armeabi
NO FILES WHATSOEVER (despite armeabi having 2 x .so files in the setup of the project​
mips
The 2 x .so files are there (i.e included in the jar)​
x86
The 2 x .so files are there (i.e included in the jar)
Folder armeabi-v7a is NOWHERE to be seen inside the jar that was created.

Can someone please advise what is the solution to this?

Thanks

Johan
 

Johan Schoeman

Expert
Licensed User
Longtime User

Johan Schoeman

Expert
Licensed User
Longtime User
Top