Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write applications in C or C++ for Android? [closed]

Tags:

c++

c

android

People also ask

Can you write Android applications in C?

You can add C and C++ code to your Android project by placing the code into a cpp directory in your project module. When you build your project, this code is compiled into a native library that Gradle can package with your app.

Can I write a mobile app in C?

Objective-C was the first language supported by Apple for developing iOS mobile apps.


For anyone coming to this via Google, note that starting from SDK 1.6 Android now has an official native SDK.

You can download the Android NDK (Native Development Kit) from here: https://developer.android.com/ndk/downloads/index.html

Also there is an blog post about the NDK:
http://android-developers.blogspot.com/2009/06/introducing-android-15-ndk-release-1.html


The Android NDK is a toolset that lets you implement parts of your app in native code, using languages such as C and C++. For certain types of apps, this can help you reuse code libraries written in those languages.

For more info on how to get started with native development, follow this link.

Sample applications can be found here.


Normally, you have to:

  1. Install Google Android NDK. It contains libs, headers, makfile examples and gcc toolchain
  2. Build an executable from your C code for ARM, optimize and link it with provided libs if required
  3. Connect to a phone using provided adb interface and test your executable

If you are looking to sell an app:

  1. Build a library from your C code
  2. Create simple Java code which will use this library
  3. Embed this library into application package file
  4. Test your app
  5. Sell it or distribute it for free

Google has released a Native Development Kit (NDK) (according to http://www.youtube.com/watch?v=Z5whfaLH1-E at 00:07:30).

Hopefully the information will be updated on the google groups page (http://groups.google.com/group/android-ndk), as it says it hasn't been released yet.

I'm not sure where to get a simple download for it, but I've heard that you can get a copy of the NDK from Google's Git repository under the donut branch.