Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I do Android Programming in C++, C?

Tags:

c++

android

Can I do Android programming in C++, C? If the answer is "yes" then please tell how? And what's the procedure to set up?

I don't know Obj-C, Java, but well-versed in C, C++, Flash AS3, SDK released by Google.

Please do not tell about NVDIA SDK it's not fully developed :)

like image 365
Amit Sharma Avatar asked May 05 '10 13:05

Amit Sharma


People also ask

Is C is good for Android app development?

Programming languages. Java and Kotlin are listed as the official languages for Android programming but there are alternatives. You can also use C and C++ using the Android Native Development Kit – the tool for implementing parts of previously written app in native code.

Can I write a mobile app in C?

(Recently rebranded "Marmelade") Using C/C++ you can build apps for Windows Mobile, iPhones, Android. The only component I didn't like was the GUI composer - a buggy one, but you always can substitute it with the Notepad. Show activity on this post.


1 Answers

PLEASE NOTE: THE ANSWER BELOW IS HORRIBLY OUTDATED, AND MIGHT NOT BE ENTIRELY CORRECT ANYMORE.

You can program in C/C++ using the Android NDK. You'll have to wrap your c++ codebase in a static library and load that through a Java wrapper & JNI.

The standard NDK does not support RTTI and a lot of the functionality of standard c++ is also not available such as std::string, etc. To solve this you can recompile the NDK. Dmitry Moskalchuk supplies a modified version of the NDK that supports this at http://www.crystax.net/android/ndk-r3.php. This modified version works on all Android phones that run on an ARM processor.

Depending on the kind of application you should decide to use Java or C/C++. I'd use C/C++ for anything that requires above average computational power and games -- Java for the rest.

Just pick one language and write the majority of your application in that language; JNI calls can decrease your performance by a lot. Java isn't that hard though -- if you know how to program in C/C++. The advantage of Java is that the application can run on any device running Android, where as NDK applications depend on the architecture it was compiled for.

like image 131
Charles Avatar answered Sep 28 '22 04:09

Charles