Android APK filepath layout for NDK binary executables how-to

139 views Asked by At

I've developed a cross-platform application that runs on Lua and Mongose. Both are binary ELF executables.

For Android I just cross-compile both of them and launch Mongose in a background process.

It works properly but to run them I'm doing something quite "unprofessional".

STEP 1 - I place Lua and Mongose in assets/appFiles/bin to create the apk.

STEP 2 - Then, at startup I check whether the bin/* files have been copied to a proper directory in getFilesDir().getAbsolutePath()+"/appFiles/bin". If that's not the case I copy them, change execution permissions, and finally run Mongose in background.

It works, but I guess there must be a more direct way that will not require to place binary files in the asset directory and then copy to a second location.

(The Android-NDK docs I've read speaks just about how to layout JNI libraries in jni/lib/"abi"/..., but they don't mention anything about proper file layout of ELF binary executables inside the APK)

0

There are 0 answers