我发现很多教程展示如何开始开发使用NDK Android应用程序。
I found a lot of tutorials showing how to start developing Android Applications using NDK.
不过,我有一个相当简单/愚蠢的问题:
But I have a rather "easy/stupid" question:
请考虑以下两个教程:
http://mobile.tutsplus.com/tutorials/android/ndk-tutorial / http://www.indiedb.com/tutorials/creating-compiling-and-deploying-native-projects-from-the-android-ndk http://mindtherobot.com/blog / 452 / android的初学者,NDK,安装一步一步/ http://marakana.com/forums/android/examples/49.html http://mobile.tutsplus.com/tutorials/android/ndk-tutorial/ http://www.indiedb.com/tutorials/creating-compiling-and-deploying-native-projects-from-the-android-ndk http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/ http://marakana.com/forums/android/examples/49.html现在,在第二个教程,他们正在建设的 HELLO-JNI
的例子。
Now, in the second tutorial they are building the hello-jni
example.
我的问题是:
使用后的 NDK建造
和产区的:
是它可能使用结果 libhello-jni.so
和分发本给别人,而不是实际 C
code?
is it possible to use the resulted libhello-jni.so
and distribute this to others instead of the actual C
code?
例如修改 Android.mk
和替换 com_myproject_MyActivity.c
到的东西。所以
以包括共享库:
For example modifying the Android.mk
and replacing com_myproject_MyActivity.c
to something.so
in order to include the shared library?:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib
LOCAL_SRC_FILES := com_myproject_MyActivity.c
include $(BUILD_SHARED_LIBRARY)
任何建议或教程欢迎。先谢谢了。
Any suggestions or tutorials welcome. Thanks in advance.
您可以通过复制到库/ armeabi
使用prebuilt NDK库(或任何架构是它),然后装在运行时。从Android构建系统的角度来看,它只是一个文件中的APK包含。
You can use a prebuilt NDK library by copying it into libs/armeabi
(or whatever architecture is it for), then loading in run-time. From the standpoint of the Android build system, it's just another file to include in the APK.
但问题是,JNI函数名称包括,按照惯例,包和类的名称,他们将属于;因此从SO消费项目的角度来看,它的使用将看起来相当不自然,因为没有任何的JNI功能将融入它的类。你可能要发布一个同伴JAR其中相应的Java类中声明。
The problem, however, is that the JNI function names include, by convention, the name of the package and class they will belong to; so from the standpoint of a SO consumer project, its use will look rather unnatural, as none of the JNI functions would fit into its classes. You'll probably have to ship a companion JAR where the respective Java classes are declared.
上一篇:使用的libxml为Androidlibxml、Android
下一篇:"最小"源文件使用Eclipse创建+ ADT Android应用源文件、最小、QUOT、Android