4 ms·
> I wonder if Google made a mistake by not choosing native code for Android apps. We have heard forever about Java (and other run-times) getting close to C in p
by Ologn 13y ago
> I wonder if Google made a mistake by not choosing native code for Android apps. We have heard forever about Java (and other run-times) getting close to C in performance, but outside of specific test cases native code still runs circles around everything else out there.
You can use native code for Android apps. I do. In the NDK samples there is an app called NativeActivity which is 100% C/C++. You compile an APK without writing any Java/Dalvik code.
From my anecdotal knowledge, most of the popular Android games are written mostly in C++, using the OpenGL ES library, and have a common code base with their iOS counterparts. Maybe they are all native code, maybe they use some Java and JNI stuff, but they are mostly C++. So Android is native on the game side, where it is needed.
A deep look at how all native code runs will show some non-native system code run when it launches, but that becomes pedantry if performance and not purity is the focus.
Android is cleft in two - applications are mostly Java/Dalvik with maybe some JNI access to C/C++ libraries, games from all my discussions with Android game developers are usually mostly the same C++ code and OpenGL ES they are using on iOS.
One example I know a little about is Jigzo. It is an open source game which is C++ and uses OpenGL and SDL libraries. The original developer ported it to iOS. I ported it to Android. Same basic code base, with a few tweaks for each OS. I changed the name from Jigzo to Jigsaw Puzzles on Play though.
- mdwrigh2 13y agoThe NDK is great for games, but is really not meant for other types of applications. It lacks a ton of mechanisms to interact with other pieces of the platform.
- pjmlp 13y agoI also do use NDK for my hobby graphics programming, but outside games it is pretty much handicapped and very few people like to write JNI code everywhere. Not to mention the performance issues due to marshaling. At least now the NDK has some sample source code for JNI helper classes to ease the pain. Qt is the only sane approach for doing full Android applications in C++, but then one is writing multiplatform code anyway.