Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to use only Java (without C++ /NDK) for building good, fast, beautiful Android apps (including 3D development)?

When I look for Android developer position requirements (vacancies), I see that knowledge of C/C++/NDK is very important. Some companies even require to build their test tasks using only C++ (OpenGL).

share|improve this question
Why would you want not to know something? Since it is at least useful, you'd better spend a couple of days and learn it. – SK-logic Nov 2 '12 at 11:53
Have you ever tried to use OpenGL in Java? It's a real pain to do. – Sulthan Nov 2 '12 at 12:09

In most cases you do not need c/c++ to develop for android.

According to Android NDK Overview

II. Android NDK Non-Goals:

The NDK is not a good way to write generic native code that runs on Android devices. In particular, your applications should still be written in the Java programming language, handle Android system events appropriately to avoid the "Application Not Responding" dialog or deal with the Android application life-cycle.

however c/c++ is important if you want to use existing c/c++ libraries.

Example: Android has no build-in mp3 encoder but you can use opensource lame library.

The same might apply to 3d-imageprocessing

share|improve this answer
That's just the hype from Google - all the fast and fancy games I have on my phone are built with the NDK - look for yourself, get Addons Detector (originally for showing dodgy ad networks) and look at the developer toolkit section. You'll see all the good stuff is built with the NDK. Now whether that's because java sucks or because all the best developers use C/C++ is debatable. – gbjbaanb Nov 2 '12 at 12:57
@gbjbaanb: games are somewhat of a special case (on both the Desktop and on mobile platforms). Granted, on mobile platforms they are a more widespread special case ;-) – Joachim Sauer Nov 2 '12 at 13:02
@gbjbaanb: intresting to hear that most fast games are developped in c/c++. Are these Games Cross-platform? (i.e. exist for android and iphone?) – k3b Nov 2 '12 at 13:06
The only language that allows writing portable applications is still C++. That's simply fact. Some mobile platforms hava Java, some have CLR, but neither is reasonably available on all. Therefore any complex application will have C++ core. On top of which it may have Java UI for Android. – Jan Hudec Nov 2 '12 at 13:51

There are many applications in Java. Development in Java is faster and the devices are so powerful these days that efficiency does not matter when the application is mainly cool user interface for some data pulled off the net. Which is majority of applications out there. So you can certainly get a job in Android application development even without C++ knowledge.

There are however several very good reasons to choose C++ for more complex applications:

  1. To this day C++ is still the only language portable to all platforms. Some mobile platforms have Java, some have CLI/CLR (.NET), but neither is available on all of them. Writing portable application in C++ is a lot of work, but is doable and proven by many examples.
  2. Java has memory inefficiency built into the language. If you look at various comparisons, similar task usually takes 3-10 times more memory in Java than in C++. So if you are doing something that needs lot of data in memory, Java would not be good choice (note that situation is much better with CLI/CLR).
  3. Dalvik, the JVM on Android, is quite a bit behind the best of breed JVMs like HotSpot. So if you are doing something that really needs raw computing power, Java is not a good choice on Android. There are however very few applications that actually need that much power. Most applications just sit there and twiddle their thumbs 99% of time waiting for user to click something and for that kind of applications Java is fine (for most of them even Python would be fine).

I think the first reason is by far the most important.

share|improve this answer
Correct me if I'm wrong, but don't even NDK apps have to compile to Dalvik to even run on Android devices? – Michael K Nov 3 '12 at 2:30
@MichaelK: Well, yes and no. The native code is native machine code, not Dalvik. But it needs a bit of Java glue and Dalvik is loaded for it and runs that glue (and the native part is loaded into it as shared library). The latest NDK reduced the need for the glue a lot, but I am not sure whether completely. – Jan Hudec Nov 5 '12 at 9:25

It depends on how 'native' your apps are expected to go. It seems that for now, many apps need to be native in order to give the full Ux/UI that end users demand. Will the HTML5 & Java based API abstraction become good enough to not need this going forwards? Who knows :-)

share|improve this answer

It works perfectly when modifying for C/C++ code, but when java code is modified it does not automatically rebuild it. Java modifications are not send to emulator or device.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.