This is a recurring problem people have often: trying to port a big C/C++ project to the Android platform. You have thousands of lines of tested and working C/C++ code that you want to reuse and access from your Android application. So far Android only provides an SDK for Java applications, only supports devices with ARM, MIPS and x86 architectures, and several steps are necessary if you want to port your code and call it from Java as a library. By large the biggest deployment is for ARM processor devices, so we are initially focused on porting our code to this architecture.
Porting your C/C++ project to the Android platform entails then the following steps:
- Cross-compile the C/C++ code for the ARM processor (or any other supported) architecture.
- Develop a JNI module allowing an Android application to natively call the C/C++ code from Java.
- Develop an Android application using the JNI module.
- Run and debug the app on an Android device.
Developing an Android application requires the Android Software Development Kit (SDK), while cross-compiling your C/C++ code and developing the JNI module for Android requires the Android Native Development Kit (NDK). Both these kits run on Windows XP/Win7, Mac OS 10.5.8 or later (Intel), or Ubuntu Linux 8.04 or later.
Development Environment
- Processor: Intel(R) Core(TM) 2 Duo CPU E8600 @ 3.33GHz
- RAM: 4GB DDR2 SDRAM DIMM 240-pin
- OS: Ubuntu Linux 12.04
- Eclipse IDE Juno
- Android SDK r20
- Android NDK r8
Testing Environment
- LG Thrill 4G - Android 2.2
- Samsung Galaxy Tab 8.9 - Android 3.2
- Samsung Galaxy Tab 2 7.0 - Android 4.01
- Samsung Galaxy S III - Android 4.0.4
Thank you for sharing run C/C++ program on Android
ReplyDelete