I\'m testing out the new Android Studio C/C++ building via CMake through stable gradle (http://tools.android.com/tech-docs/external-c-builds).
In my app, an already
Make the executable files output to where the Android Gradle plugin expects libraries:
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
Fool the plugin into thinking your executable is a shared object:
add_executable(i_am_an_executable.so main.c)
Check the APK:
$ 7z l build/outputs/apk/app-debug.apk lib/ [2:08:56]
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
..... 9684 4889 lib/armeabi/i_am_an_executable.so
..... 6048 1710 lib/arm64-v8a/i_am_an_executable.so
..... 9688 4692 lib/armeabi-v7a/i_am_an_executable.so
..... 5484 1715 lib/x86/i_am_an_executable.so
..... 6160 1694 lib/x86_64/i_am_an_executable.so
Access and run your executable; it is located in context.getApplicationInfo().nativeLibraryDir.
The downside to this is that you cannot set android:extractNativeLibs to false — I don't know of any way to access lib/ in an APK from within the app.