F Falco32 Member Licensed User Longtime User Jan 15, 2013 #1 I have a question. I have created a java library project wich includes a JNI library libxxx.so but when i compile this project the library file is removed from package. does the new compiler accept the JNI libs folder ? in a custom library project ? Regards Falco32
I have a question. I have created a java library project wich includes a JNI library libxxx.so but when i compile this project the library file is removed from package. does the new compiler accept the JNI libs folder ? in a custom library project ? Regards Falco32
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2013 #2 The compiler supports any additional files. Make sure that the native library is included in the Jar file (open it with 7zip or similar tool). Upvote 0
The compiler supports any additional files. Make sure that the native library is included in the Jar file (open it with 7zip or similar tool).
warwound Expert Licensed User Longtime User Jan 15, 2013 #3 Hi. There's a little info here: http://www.b4x.com/forum/bugs-wishlist/21726-wish-compiler-support-so-library-files.html Basically you need to ensure that when you compile your library in Eclipse that the library jar contains a folder lib and that your .so file(s) are within that lib folder. When you compile your B4A app, the .so file(s) should now get added to the APK and when the APK is installed the device will automatically install the .so file(s) to the internal memory where your app is installed. Martin. Upvote 0
Hi. There's a little info here: http://www.b4x.com/forum/bugs-wishlist/21726-wish-compiler-support-so-library-files.html Basically you need to ensure that when you compile your library in Eclipse that the library jar contains a folder lib and that your .so file(s) are within that lib folder. When you compile your B4A app, the .so file(s) should now get added to the APK and when the APK is installed the device will automatically install the .so file(s) to the internal memory where your app is installed. Martin.
F Falco32 Member Licensed User Longtime User Jan 15, 2013 #4 Thanks !!! Folder lib not libs ??? the result in eclipse are multiple subfolders(armabi armabi-v7) in the folder libs. what should i do with this ? can i load the so files with System.LoadLibrary("libxx") ? Upvote 0
Thanks !!! Folder lib not libs ??? the result in eclipse are multiple subfolders(armabi armabi-v7) in the folder libs. what should i do with this ? can i load the so files with System.LoadLibrary("libxx") ?
Erel B4X founder Staff member Licensed User Longtime User Jan 15, 2013 #5 Keep the subfolders. You should call: System.loadLibrary("xx") without the lib prefix. Upvote 0
warwound Expert Licensed User Longtime User Jan 15, 2013 #6 Falco32 said: the result in eclipse are multiple subfolders(armabi armabi-v7) in the folder libs. Click to expand... That's ok. The .so file in the armabi folder is (i think) for devices that have no hardware floating point unit - that's generally old or low end devices. armabi-v7 contains an .so file that is compiled to make use of a hardware floating point unit (ie it's faster than non-floating point unit). Android will, when you install your app, decide whether to use the .so file from armabi or armabi-v7 based on the device capabilities - it's all handled automatically. Some libraries even have a x86 folder with a .so file compiled for Android devices that have x86 CPU, again the Android installation process handles which .so file gets used on the device. Martin. Upvote 0
Falco32 said: the result in eclipse are multiple subfolders(armabi armabi-v7) in the folder libs. Click to expand... That's ok. The .so file in the armabi folder is (i think) for devices that have no hardware floating point unit - that's generally old or low end devices. armabi-v7 contains an .so file that is compiled to make use of a hardware floating point unit (ie it's faster than non-floating point unit). Android will, when you install your app, decide whether to use the .so file from armabi or armabi-v7 based on the device capabilities - it's all handled automatically. Some libraries even have a x86 folder with a .so file compiled for Android devices that have x86 CPU, again the Android installation process handles which .so file gets used on the device. Martin.
F Falco32 Member Licensed User Longtime User Jan 16, 2013 #7 thx a lot guys! it works great!!! a next question. in this folder in my project is as result also the standalone binary xxx.bin. Is there any way to load this binary from lib folder ? I would like to start a binary from libs folder because i need root rights. Is it possible ? And when so can you give me a short two liner how can i start this from the java lib ? Thanks so much!!! Upvote 0
thx a lot guys! it works great!!! a next question. in this folder in my project is as result also the standalone binary xxx.bin. Is there any way to load this binary from lib folder ? I would like to start a binary from libs folder because i need root rights. Is it possible ? And when so can you give me a short two liner how can i start this from the java lib ? Thanks so much!!!
Erel B4X founder Staff member Licensed User Longtime User Jan 17, 2013 #8 Running binary executables in Android is problematic. There was a discussion about this issue in the forum without any success. Upvote 0
Running binary executables in Android is problematic. There was a discussion about this issue in the forum without any success.