Bundling an external library? Is this possible?


#1

I just started looking at JUCE for Android development and I'm still struggling to comprehend how easy it has been to get up and running! I've not even had to install Eclipse :) Muchas gracias.

I've been able to build my project and link to an external library without a problem from the command line but I'm at a loss as to how to bundle the library with the .apk? Can the Introjucer be instructed to bundle external libraries? I really hope this is possible without having to go near dEquips..

[EDIT] I should have said I did try to copy and paste the library to the libs folder of the bundled .apk but this did not work..

[Further edit] The libray I'm triyng to link to is a native .so..


#2

Am sure it's possible but haven't tried it myself..


#3

Linking in a native .so on Android needs to be done in Java code, because for some reason using "dlopen()" inside JNI code doesnt' always work.  You would use System.loadLibrary()  with just the name part of the lib, e.g. "xxx" if your so was called "libxxx.so".

The .so file is packed in your apk, put it in the 'libs/armeabi' (or whatever is appropriate) directory and when the apk is packaged up, your so will be inside it and your app can load it using the API call I mentioned.


#4

Thanks, I managed to sort this out by hacking the .mk makefiles for the project generated by the Introjucer. I also had to call System.LoadLibrary() as you mentioned. So far so good. Now I just need to figure out how to load a text file from .apk bundle once my app launches. Maybe I can use 'currentApplicationFile' and then work back to the res folder from that.