Can I make a rather native C++ app with Android? Can I make a rather native C++ app with Android? android android

Can I make a rather native C++ app with Android?


As of NDK r5 with Android 2.3 (Gingerbread) this is possible, although I assume only devices to support natives apps must have Gingerbread on them.

From the native-activity sample:

The Android SDK provides a helper class, NativeActivity, that allows you to write a completely native activity. With a native activity, it is possible to write a completely native application. NativeActivity handles the communication between the Android framework and your native code, so you do not have to subclass it or call its methods. All you need to do is declare your application to be native in your AndroidManifest.xml file and begin creating your native application.


It is really not my cup of tea but there is something called Android NDK (Native Development Kit) to use if you want to write your program in C. Not sure how the C++ compiler support is though.

As far as I know your app can be almost 100% native code but keep in mind that by walking that way you will probably have a hard time supporting the different CPUs out there in Android hardware. If you need to bootstrap the native code so that it is started from java it is probably not a very big problem for you.

I found a few different tutorials when googling for "Android NDK". This one is a very minimalistic Hello World. Obviously you want something much more than a library that returns a string to java but it is a good first start and you will probably have to do all of the things described. Do a search using NDK and Android as keywords and you get a good selection. I see no reason to list them here as such lists tends to be outdated and broken within a year or so.

I guess the official Android Developer site from Google will stay put and be updated on new releases of the platform, it has a link to the current NDK.


With Gingerbread (Android 2.3) it looks like you can build your entire app in C++.

cf:http://phandroid.com/2011/01/11/android-developers-blog-awesome-ndk-leads-to-awesome-apps/

"With the latest version of the NDK, r5, many big improvements have been made to coincide with the release of Gingerbread. The most major is the ability to code a native application for Android 2.3 entirely in C++. This means even programmers and developers with no Java knowledge won’t have to implement a single line of that code..."

Can't vouch for the veracity of this blogger, however, from what I have read, it appears you can do this