Create Android.mk to build a C library
I'm developping an app which needs to use a Java library (jpcap: http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/download.html). The problem is that library uses JNI to call methods written in C code.
In order to call correctly the Java methods I have to compile the C code of the library using the Android NDK. To compile the C code I have to write an Android.mk file to use it with the ndk-build script which provides the NDK.
I've never written before an Android.mk and I don't know how to write the file to fit my needs which are the next:
Compile the following source files:
JpcapCaptor.c JpcapSender.c JpcapWriter.c packet_arp.c packet_datalink.c packet_icmp.c packet_ip.c packet_ipv6.c packet_tcp.c packet_udp.c
Include the following libraries:
jni.h pcap.h
Link using the开发者_如何学编程 -lpcap option.
If any of you guys could tell me which lines do I have to write in the Android.mk file or tell me where to find a manual which explains this I would be very thankfull.
Try using this :
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $$Add source files$$
LOCAL_LDLIBS := -lpcap
LOCAL_MODULE := libtest
LOCAL_C_INCLUDES := $$Path of the header files used$$
include $(BUILD_SHARED_LIBRARY)
精彩评论