On Friday, December 14, 2012 7:07:06 PM UTC+2, Timo wrote:
The project setup it's like this:
- Native library which contains also JNI wrapper code (no activity there)
Is the native library in C or C++ source code form, or just an .so file?
- Java application project which uses the JNI wrapper code (it contains the activity)
So there is IMHO no use for native support at the Java application project.
Look, the development system will work smoother for you once you stop resisting
and add "native support" :-) The only projects that don't require adding "native
support" are projects that don't use any JNI libraries.
Adding "native support" means:
1) If you're building the native library yourself (i.e. you have its C or C++
source code), then Eclipse will build your native library as part
of the project build.
For example, if you decide to add more native functions, then you could
edit the C files and rebuild right from Eclipse.
But even if you're not building it yourself, though, then still...
2) When you run or debug your project on a device (or an emulator),
Eclipse will pack your native library into the .apk file and copy it to the device.
3) You could use the native debugger from within Eclipse.
As someone else has mentioned, edit your Eclipse project configuration
and add NDK_DEBUG=1 to your NDK builder's command line.
IIRC ndk-build also does things like copying your library to the correct
directories, *even when it's a prebuilt library*.
- - -
To know what native libraries your project uses (either built by you,
or prebuilt), the Android build / deploy / debug system will use
the jni/Android.mk file.
If it's a prebuilt native library (i.e. one you don't have the source code for,
or have no intention of rebuilding), please read docs/PREBUILT.html
for instructions on how to add it to jni/Android.mk.
After you add native support to your Eclipse project, it'll start using
jni/Android.mk for the above-mentioned purposes.
Starting ndk-gdb in the native library folder leads to the situation that I am forced to edit the ndk-gdb script and set the PACKAGE_NAME hardcoded to the package of the main app - I already explained that in the first posting.
Build setup itself is fine.
I'm not quite sure how it works for you right now. Did you somehow manually
forge the .so file into the .apk?