The most exciting announcement at I/O to me was the news that the NDK is no longer a third-class citizen on Android. It might not be in first class just yet, but it's at least moved to premium economy.
I'm curious to see how you folks end up using the NDK, now that it's no longer targeted solely at masochists and game developers.
Should we all start using C++ to write Android apps? Well, no. There's a cost to transitioning between native code and managed code, including a lock acquisition (which, as you know, should be treated as a call that may block indefinitely.) It's orders of magnitude more complicated than a Java function call. Chances are, there's a lot of code in your app that interacts with the Android Framework in Java, and the last thing you need is to add a massive perf penalty to every framework method call.
In addition, Android's ahead-of-time bytecode compiler isn't too shabby. It's not hard to find benchmarks showing AOT code running just as fast as native code.
But there are some areas where the NDK is a clear win. It comes back, once again, to JNI overhead. Most of the Android framework is written in Java, but a large part of it is in C/C++. For instance, almost every method in the current Java OpenGL implementation is a wrapper around native methods. Same goes for MediaCodec (in L+),* and much of Canvas. Calling those methods from Java incurs the same overhead as a call from native code to the framework.
The NDK doesn't expose all of Canvas, and MediaCodec isn't a very chatty API, so writing native code for those components doesn't seem too attractive. But OpenGL? Oh hells yeah. That API is super chatty. As an added bonus, it uses a lot of floating-point math, which is something C++ is pretty good at (especially if you use NEON, which you can't do from managed code right now). So I think I can make a pretty good case for moving my GL code to native.
I'll be experimenting with some other use cases over the summer-
well, I will as soon as +Xavier Ducrohet releases the long-awaited C++ plugins for Android Studio. Just knowing that they're almost ready to ship makes it impossible for me to go back to Eclipse right now. :
*Previously the NDK's MediaCodec implementation called back into Java, which then called back into C, so it was kind of the worst of both worlds.