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

C++Android

C++ Problem Overview


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 :)

C++ Solutions


Solution 1 - C++

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.

Solution 2 - C++

You should use Android NDK to develop performance-critical portions of your apps in native code. See Android NDK.

Anyway i don't think it is the right way to develop an entire application.

Solution 3 - C++

Yes, you can program Android apps in C++ (for the most part), using the https://developer.android.com/tools/sdk/ndk/index.html">Native Development Kit (NDK), although Java is the primary/preferred language for programming Android, and your C++ code will likely have to interface with Java components, and you'll likely need to read and understand the documentation for Java components, as well. Therefore, I'd advise you to use Java unless you have some existing C++ code base that you need to port and that isn't practical to rewrite in Java.

Java is very similar to C++, I don't think you will have any problems picking it up... going from C++ to Java is incredibly easy; going from Java to C++ is a little more difficult, though not terrible. http://triton.towson.edu/~mzimand/os/Lect2-java-tutorial.html">Java for C++ Programmers does a pretty good job at explaining the differences. Writing your Android code in Java will be more idiomatic and will also make the development process easier for you (as the tooling for the Java Android SDK is significantly better than the corresponding NDK tooling)

In terms of setup, Google provides the https://developer.android.com/tools/studio/index.html">Android Studio IDE for both Java and C++ Android development (with Gradle as the build system), but you are free to use whatever IDE or build system you want so long as, under the hood, you are using the Android SDK / NDK to produce the final outputs.

Solution 4 - C++

You should look at MoSync too, MoSync gives you standard C/C++, easy-to-use well-documented APIs, and a full-featured Eclipse-based IDE. Its now a open sourced IDE still pretty cool but not maintained anymore.

Solution 5 - C++

You can take a look also at C++ Builder XE6, and XE7 supports android in c++ code, and with Firemonkey library.

http://www.embarcadero.com/products/cbuilder

Pretty easy way to start, and native code. But the binaries have a big size.

Solution 6 - C++

You can use the Android NDK, but answers should note that the Android NDK app is not free to use and there's no clear open source route to programming Android on Android in an increasingly Android-driven market that began as open source, with Android developer support or the extensiveness of the NDK app, meaning you're looking at abandoning Android as any kind of first steps programming platform without payments.

Note: I consider subscription requests as payments under duress and this is a freemium context which continues to go undefeated by the open source community.

Solution 7 - C++

There is more than one library for working in C++ in Android programming:

  1. C++ - qt (A Nokia product, also available as LGPL)
  2. C++ - Wxwidget (Available as GPL)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAmit SharmaView Question on Stackoverflow
Solution 1 - C++CharlesView Answer on Stackoverflow
Solution 2 - C++haraView Answer on Stackoverflow
Solution 3 - C++Michael Aaron SafyanView Answer on Stackoverflow
Solution 4 - C++JPMView Answer on Stackoverflow
Solution 5 - C++FadyView Answer on Stackoverflow
Solution 6 - C++Herman TootView Answer on Stackoverflow
Solution 7 - C++Amit SharmaView Answer on Stackoverflow