Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting a C++ application to android

Is it possible to port a C++ application which uses the STL extensively to Android? I understand that currently the NDK does not support this, but is there any effort (open source or otherwise) underway to achieve this?

If not is there a way to cross compile libstdc++ for Android?

UPDATE: Ndk Revision 5 promises a default STL implementation based on STLport. http://android-developers.blogspot.com/2011/01/gingerbread-ndk-awesomeness.html Read this official NDK blog post, http://developer.android.com/sdk/ndk/index.html>and the revision notes.

like image 663
vivekian2 Avatar asked Apr 28 '10 00:04

vivekian2


People also ask

Can I run C program in Android?

Android is based on Linux Kernel so it's definitely possible to compile & run C/C++ programs on Android. C is quite cross-platform , so a C Program written in Windows can Run on Linux ( and android ) and vice versa.

Can you build an Android app with C++?

C++ can be used for Android App Development using the Android Native Development Kit(NDK). However, an app cannot be created totally using C++ and the NDK is used to implement parts of the app in C++ native code. This helps in using C++ code libraries for the app as required.

Can we make APK using C?

yes you can. theoretically! or you may even write the assembly for your apk directly. Save this answer.


1 Answers

You may want to start with Dmitry Moskalchuk's modified version of the NDK (includes support for exceptions, RTTI, and the standard c++ library). Keep in mind that if you go down this path your application's size will be larger as you will be statically linking a c++ library into it. Also, this thread from the andriod-ndk group may give better direction on how to incorporate the STL.

like image 196
Tim Kryger Avatar answered Sep 28 '22 12:09

Tim Kryger