In July of 2009, the Android Team released the Native Development Kit, a set of C and C++ libraries tailored for Android application development. As Android has progressed, so has the NDK, and, as Chris Pruett of Google points out on the Android Developers Blog, as the awesomeness of the NDK increases so does the awesomeness of Android apps using it. He expresses the directly proportional relationship in the below graph, noting that the limit of the function is “infinite awesomeness.”
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.
A bunch of other aspects of the latest NDK and more technical info for developers can be found at the source link below. A similar equation to the one above states that the more awesome developers that learn to use the awesome NDK will mean even more awesome Android applications.
[via Android Developers Blog]
C++ = Memory Leaks. LOL!
@Mark. Exactly lol. I wish they would add Go and Python as development languages.
Mark you must be the most uninformed person in the world. C++ != memory leaks, Poor Programming = Memory leaks. NO MATTER THE LANGUAGE.
Look no further: http://developer.android.com/resources/articles/avoiding-memory-leaks.html
Last time I checked, that was Java.
so does that mean they cannot code in java anymore for 2.3?
“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.”
I second that python request
“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.”
That is a big deal. Most game development is in c/c++ and not java.
@Jon: Well said, brother.
Since Iphone programing is already done in C I think it’s to make it easier for devs to have apps for either mobile platform.
Assembly FTW!
This is great news! I hope this trend continues with android. This is a perfect example of how open source is supposed to work. I hope that soon there are more choices for all software developers… no matter what platform… because that will ensure options for (us) the consumers.
Have to delve into this yet. But does this mean that one has access to the whole API library in C++ also? Because that would be truly awesome. Native apps are a whole lot faster.
But it’s very sad, that many users are stuck with 1.x/2.1 androids, buyers of new devices will be stuck with 2.2 and even Nexus One by Google is stuck with that. That means devs can not use these awesome features until market is filled with 2.3 devices and we, users, are screwed.
“That means devs can not use these awesome features until market is filled with 2.3 devices and we, users, are screwed.”
In that case, phone providers should attempt to work more closely with the Android hacking and modding community, so that things like 2.3 can [officially] get onto the HTC Desire within a matter of days or weeks, rather than months.
why they ar eusing C++.
I think they sud go with much powerful language as Java or c#
ATUL
don’t get me started Atul…java or c# more powerful? Easier to use yes, but definitely NOT more powerful.
-B
@comment #14: you’re an idiot.
I think coding in C/C++ is the preferred choice over Java for high performance needs on a mobile device. Memory leaks? Probably, especially for the “green” developers. But this helps the seasoned C++ developers make some awesome games and apps. Do you think modules like game engines and real time systems are best written in interpreted languages like Java?
C++ – big step backwards.
Big step backwards? Hardly. The SDK (not to be confused with the NDK) is not being shelved or abandoned. So, now there is a choice; if you’re scared of native/low level developing, use the still improving SDK, which is still Java.
Seeing the most common complaints about apps is the reaction time and smoothness java and C# and not good and C/C++ is king in making clean fast code.
C++ – big step backwards >> only for people that are not talented enough to use it.
Mr”Truthiness” Your expertise about C++ vs. “other” languages is interesting. You do realize that all, John Carmack, Tim Sweeny(obviously video game programmers) cuttin edge programmers use C++ because you can derive the most power or performance from devices (closer to the “metal” of the machine–machine language would be closer) which:::: is what I want — more performance out of lower clock and powered devices. That being said — only amateur or amateur student programmers would have issues with C++ in terms of memory management(things like pointers became second-nature)
Makes me wonder why Google even chose Java in the first place. It seems to offer them no practical advantages yet, and so far it has offered only disadvantages: slowers apps until Froyo (and still slower than c++ ones), the Oracle lawsuit, etc. It doesn’t seem like they’re going to develop a x86 Android version in parallel with the ARM onem and Intel doesn’t seem to care much about it either. The only way I can see this as an advantage is maybe 10-15 years from now when we’ll have to switch to quantum computing or whatever, when both x86 and ARM architectures will reach their limits. Then we’d be sure that the apps made in 2010 for ARM will work on quantum phones in 2025, too. And it might avoid the legacy disruption that Microsoft will soon face when they switch Windows to ARM and no previous apps will work on it. But until we get there, using Java and a virtual machine seems kind of useless and with a lot of drawbacks. Does anyone else have a different opinion on this? What other advantages does the virtual machine offer right now?
The sheer amount of stupid in this thread is disturbing. If you don’t know that C++ is the most common language for game development and that the iPhone mainly uses a horrible version called Objective C than you probably shouldn’t be commenting in here.
lol’ing at the overabundance of stupidity and ignorance in this thread. Save yourself the embarrassment and don’t post if you don’t know the first thing about programming. Improved native support is a good thing in case you weren’t sure.
I’m loving the scales, awesomeness. hehe
My opinion as C++ developer is that this is the best step for Android future, and next best step will to remove java at all. Why? Because of efficiency and power consumption i.e. longer battery life. Why? Because on all VM or interpreted languages CPU will spend tens to thousands more instructions to achieve same goal.
This is awesome. Java works for a large class of apps. C++ works for a different class of apps. You can always force the issue and just use one, but like usual Google believes in giving us the options we want.
From the comments above I believe a few points need clarification:
* Yes, it’s true, with the NDKr5 you can *write* an entire app in C or C++. That, however, does not imply that the compiled application is a pure native application. There is still a lot of JNI glue code to interface with the Android infrastructure. The compiled image will still run inside a Dalvik VM.
* Java is not the worst decision ever to use as an API for a system that runs on various hardware. While it is not as fast as native code, it is usually fast enough. With native code you will have to target specific hardware, and what works on todays devices may not on a future device. A VM pretty much remedies this situation.
* Awesome NDK Leads to Awesome Apps: Absolutely! We have seen this with the iPhone for quite a while now. Android is still very much lacking in this department. In particular debugging support is by and large inexistant. Up to and including NDKr4 it was impossible to debug multiple threads. So you’re essentially left with trace logs. This is very last millenium. While the NDK’s main audience is game developers I would also have to mention that the Android emulator offers no support for OpenGL ES 2.0. Again, both iPhone and Windows Phone 7 offer better developer support.
Overall I very much welcome the ability to write performance critical code in a native language. But as long as Android does not improve as a developer platform it will not ever become a true competitor to iPhone or WM7. That is quite unfortunate.