I have been doing some research on developing on the Android platform and found that the only way to develop an app using C++ is using the NDK. I also came to know that the NDK has limited support to C/C++, with C++ having even lesser support than C. Here's the problem. I need to develop using C++ as I'm not very familiar with Java. In fact, not familiar at all. I'm still 18, so I don't have much experience with many programming languages. After doing some more research I have found a non-official NDK, called the NDK-CrystaX that implements more support for C/C++ than the official NDK. Before I start using I have to know if it would be legal to use this custom NDK in an Android app and still be able to sell it on the Android Marketplace. Is it? Or is it not? Another solution would be if the newer releases of the NDK had full support for C/C++. But I'm not sure of that either, so I'm seeking your generosity again and asking you to share your knowledge on this too.
3 Answers
I think you'll be better off just learning Java as you learn to make Android apps. The stuff you know of C++ won't really get in your way of understanding Java.
I know it seems hard to learn a new language AND a new platform all in one go, but if you try to do it in C++, you have have an third problem: understanding the mapping from Java (which the platform is designed to support) to C++ (which it isn't). I've no idea, for instance, how memory management is handled in C++ apps for Android, as it relates to the base API.
Support will be easier for you if you stick to Java as well - most developers tend to use the 'default' toolchain (due to laziness more than anything, I suspect), so you'll have the most help available if you are also using the default toolchain.
-
Would you be kind enough to tell me what I have to know in Java to develop a basic interface to a C++ program? It's stuff related to the Java virtual machine, I guess. Jan 3, 2012 at 16:48
-
I have no idea - I do all my Android work in Java to avoid just this problem. My biggest question would be how memory is managed - C++ and Java have fundamentally different views on memory management, and you're going to have to figure out how to allocate things that you can pass to the JVM, and whether (and how) to delete things. Jan 4, 2012 at 11:53
-
Thanks alot. You have been very helpful, sir. I'm going to consider what you said whenever I start Android development. Jan 4, 2012 at 17:06
Your problem is that you don't know Java, but I promise you if you're proficient with C++ , its only a matter of a few months, you can master Java too.You say you're only 18 and you don't have experience with many languages, YES this is the time, dive into Java, you'll never regret.
-
I was thinking of getting some projects done, perhaps even commercially, before getting into another language. I'm not sure how good I am at C++. I was thinking this project could tell me and perhaps even improve me a bit. Do you have any information on the questions I asked? Or do you know where I could get my questions answered? Jan 3, 2012 at 4:20
-
@Ahmad wait, probably some one else would come up :) but I insist, java will never trouble you :) also have a look at this mosync.com– COD3BOYJan 3, 2012 at 4:28
-
+1 Going from C++ to Java is easy. Just do it; it's mainly a matter of learning the APIs (you'd have to learn the 'droid one anyway!). Jan 3, 2012 at 4:29
-
I'm not even sure if my C++ experience is enough to make anything that could be sold commercially. That's mainly the reason I'm hesitant of starting Java. Jan 3, 2012 at 17:08
Just learn Java and program your app in that, in the end it will make your life a lot easier than having to go through what are you are talking about doing.