Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are some good reasons not to use the NDK (like the rich android UI, webview, etc); but performance isn't one of them.

The point I was making is that despite the downsides, even people from inside google are using it now. Makes the android teams 'pretend ndk does not exist' stance rather ironic.



Hmm, that's a very strange assertion, I've never seen Android tem "pretend that NDK doesn't exist".

NDK is just a preconfigured GCC for cross-compilation anyway (with custom build script). Native C code compiled with NDK is used all over Android core and it's used regularly in apps to provide speed boosts. But it has practically no access to Android APIs (with exception of OpenGL/OpenAL some sensors and bitmap functions) so it's totally unsuited for development of a full app in C or C++. It's role is pretty much the same as C code in python libraries - to provide boosts for performance critical code.

Taking that into account, I really have no idea who acts like "NDK doesn't exist". It's widely used, it's just not suitable as a main way of developing an app.


It doesn't. Native code is by definition code compiled for a specific ISA, and Android is supposed to run on several ISAs, including ARMv7 and amd64. Native code is cancer on the ecosystem when you look at it from an ISA diversity perspective.


Native code runs on far more architectures than Dalvik, including (particularly) in the embedded world.

And the NDK is a rather neat solution to the compilation issue. Once you've set up the toolchain properly, different architectures are simply not an issue. There's no architecture that Android runs on that doesn't accommodate native code.

After all, don't forget that under a rather thin layer of Java, the native code "cancer" is what is driving Android.


Hogwash. If you are talking about SOURCE portability, Java runs in just as many places as C code, including in the embedded world.

If you are talking about BINARY portability (which is what everyone was actually talking about), then native code isn't portable for shit, whereas Dalvik code happily runs on multiple flavors of ARM, MIPS, and x86 with official or partially-official support.

Unless you are proposing that Android adopts a Goobuntu design of "compile everything from source", then the portability of native code source is utterly irrelevant. And if you are proposing that, you are hopelessly naive. Not to mention you must really, really hate having battery life if you want to spend over an hour compiling & installing, say, Firefox.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: