Libxml is the C-language XML parsing library, which is our first choice for developing portable programs, and the steps to porting them to Android are described below
1. Download the already configured source code package Android_libxml2.rar
Http://pan.baidu.com/s/1sjpusFj
The package also has the character Transcoding library libiconv that LIBXML2 relies on, and is also well-configured. All we do is compile first.
Libiconv, and then compile libxml2, of course, a compilation is also possible.
2. First rename the Libiconv to JNI, use the command line to enter the current directory, execute the Ndk-build
3. When renaming libxml2 to JNI, use the command line to enter the current directory and execute Ndk-build
4. Under Obj/local/armeabi, we'll generate the static libraries we need.
Here are the Mk files for libxml2 and Libiconv:
#libiconv. mk##################################
Local_path:= $ (call My-dir)
Include $ (clear_vars)
Local_cflags: = \
-wno-multichar \
-dandroid \
-dlibdir= "C" \
-dbuilding_libiconv \
-din_library
Local_src_files: = \
LIBCHARSET/LIB/LOCALCHARSET.C \
LIB/ICONV.C \
Lib/relocatable.c
Local_c_includes + = \
$ (local_path)/include \
$ (local_path)/libcharset \
$ (local_path)/lib \
$ (local_path)/libcharset/include \
$ (Local_path)/srclib
Local_prelink_module: = False
Local_module_tags: = Optional
Local_module: = Libiconv
Include $ (build_static_library)
#libxml2. mk##################################
Local_path:= $ (call My-dir)
Include $ (clear_vars)
Local_src_files: = \
C14N.C catalog.c chvalid.c debugxml.c dict.c docbparser.c \
ENCODING.C entities.c error.c globals.c hash.c htmlparser.c \
htmltree.c legacy.c list.c nanoftp.c nanohttp.c parser.c \
PARSERINTERNALS.C pattern.c relaxng.c sax.c sax2.c \
THREADS.C tree.c trionan.c triostr.c uri.c valid.c\
xinclude.c xlink.c xmlio.c xmlmemory.c xmlmodule.c \
XMLREADER.C xmlregexp.c xmlsave.c xmlschemas.c xmlschemastypes.c xmlstring.c \
xmlunicode.c xmlwriter.c xpath.c xpointer.c
Local_c_includes: = \
$ (local_path)/include \
$ (Local_path)/include/libxml\
$ (Local_path)/.. /libiconv/include \
$ (Local_path)/.. /libiconv \
$ (Local_path)/.. /libiconv/libcharset \
$ (Local_path)/.. /libiconv/lib \
$ (Local_path)/.. /libiconv/libcharset/include
Local_prelink_module: = False
Local_module_tags: = Optional
Local_cflags: =-l$ (Local_path) \
-l$ (Local_path)/. /obj/local/armeabi
Local_static_libraries: = Iconv
Local_module:=libxml2
Include $ (build_static_library)