how can I write applications in C or C++ for Android?
Most of the people know that Development of Android Application is only done in java programming language. But Reality is that Development of Android application can be done in native languages like C & C++.
I have 3 option to do this all.
1> For doing this You need to use Android NDK
The Android NDK is a companion tool to the Android SDK that lets you build performance-critical portions of your apps in native code. It provides headers and libraries that allow you to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C or C++. If you write native code, your applications are still packaged into an .apk file and they still run inside of a virtual machine on the device. The fundamental Android application model does not change.
Now To start Follow this step :
- Download & Install Google Android NDK. It contains libs, headers, makfile examples and gcc toolchain
- Build an executable from your C code for ARM, optimize and link it with provided libs if required
- Connect to a phone using provided adb interface and test your executable
If you are looking to buy an app:
- Build a library from your C code
- Create simple Java code which will use this library
- Embed this library into application package file
- Test your app
- Buy it or distribute it for free
2> Another option to Android NDK is
MoSync SDK
MoSync makes it easy, fun and cost efficient to develop mobile application for all the major platforms. Using C++ and a set of powerful APIs, you can harness the full power of modern smartphone platforms while still supporting Java ME devices using a single codebase.
In short MoSync SDK is for cross platform mobile development.
Download its current release from here.
3> Once more option is do this is
NestedVM
Binary translation for Java
NestedVM provides binary translation for Java Bytecode. This is done by having GCC compile to a MIPS binary which is then translated to a Java class file. Hence any application written in C, C++, Fortran, or any other language supported by GCC can be run in 100% pure Java with no source changes.
Here you can use nestedvm to translate C into Java bytecode, and use that as the basis of your port. For example, see the Android port of Simon Tathams portable puzzle collection.
Finally i want to share my personal thought about using native language in Android. Using native code does not result in an automatic performance increase, but always increases application complexity.
You may like to read this also....
4 Comments to “how can I write applications in C or C++ for Android?”
Post comment
Search in this website
our sponsors
latest comments
- sagar on List of all standard version of c language
- Mohit Dhukia on How to access/unblock songs.pk in india?
- shinto peter on How to configure mail from localhost ( wamp ) using PHP?
- tammylleanne on Implementation limitation of c programming language
- Deepak on How to access/unblock songs.pk in india?
Find us on Facebook
Top Authors
Find us on stackoverflow
Polls
My Bookmarks
- Audio/video Recorder & player application based on MATLAB
- check dependency of your binary
- defination of all standard c programming language function
- Great Question-Answer on c programming
- know what your c code means
- Limition of c programming language
- List of all version of c programming language
- Online c compiler
- php freelancing work
- some more stuff on C programming language
- Volatile Keyword in Embedded System
- Write Android application in c language
Thanks for the nice blog. It was very useful for me. Keep sharing such ideas in the future as well.
Hi there. Really a great post. Very interesting post for me. Thanks for sharing it.
Really i didn’t get ur points admin…what is ADM and how to optimize the c code…my question is i had downloaded and installed android NDK…i successfully ran Hellow World app in emulator(code was in java) but,i tried simple c code to execute and instantly flashes the error binary code not found what is it mean? pls help me how to run c and c++ code in android eclipse…pls reply to email……
my email id is [email protected]