![]() ![]() Now the hardest part is done and the integration with the app's interface is almost complete.If the compilation process went fine you will find the new library inside the "lib" dir in your Eclipse project.If you have some errors than run: make APP= (in my case "swift") from your NDK's root dir.This should compile everything and create the library that we'll be using in our application.Run ndk-build located in NDK's root directory from your project dir.In the above directory create a symbolic link called "project" that points to the root dir of Eclipse's project.Create a Application.mk in the above directoryĪPP_PROJECT_PATH := $(call my-dir)/project.Create a project directory (in my case I called it swift) in the apps dir of the NDK root directory.There are several ways to archive it, I'll not mention them here since it's a long process and Google will help you :-). As previously mentioned we need to first include all the needed libraries, such as the stdlib, in the NDK to be able to compile. Now we need to compile everything using the NDK. ![]() LOCAL_SRC_FILES := swift.cpp sha1.cpp compat.cpp sendrecv.cpp send_control.cpp hashtree.cpp bin64.cpp bins.cpp channel.cpp datagram.cpp transfer.cpp httpgw.cpp Create android's Makefile, called Android.mk, inside the jni dir.This will also change data structures from/to jni/c++. the new interface can be implemented based on the content of the previous header file.an interface has to be provided to the jni header file.move the new header file in the jni dir.create a jni dir in the base project dir.Create the c header file based on the above scheletron.I used NativeLib.java and implemented the functions start, stop, and progress (to report the current download status).Create a scheletron of the native library calls in the src dir using the "native" key in the declaration.The Java Native Interface (jni) is been used to call the native C++ library The above picture taken from shows how the linking between the c++ library and the java front-end works. We can than give disk/network access right to the java application. The trick is to be able to create a library that can be used by a java front-end application. The problem is that you will end up with a standalone application that can't be linked to the hardware resources and doesn't have any access permission for the system. Statically compile swift is not a bit issue, it can be easily archived by using a different compiler (not the NDK) that supports cross-compilation to ARM processor. To compile libswift we will need the stdlib that needs to be compiled and included in the NDK. Anyway the android NDK doesn't include any library except libc. Libswift uses few libraries and it's very portable. the Android NDK that provides cross compilation tools for ARM processors.At least one Android emulator (I used versions 1.6 and 2.2).Preferably Eclipse with the SKD & AVDmanager plugin for creating Android apps.To build the Android application you will need the following: This article details the steps taken in creating the Android port of the libswift library. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |