Porting a C/C++ program into Android

I am attempting to put my C++ program onto an Android phone but have run into several problems with the library linking. It seems most of the useful information I find on this topic through google is outdated (motz) or simply does not account for the complexity of my program. I have been able to run simple C programs but fail when attempting to use libraries outside of Android's Bionic/libc.

So my questions are:

  • Is it possible to port pre-existing *.so libraries onto Android? If so, how could I do this without seg faulting?
  • Should I be using the CodeSourcery compiler (arm-none-linux-gnueabi-*)?
  • How can I work around the lack of a seperate pthread library?

Please help me out! Thanks.

-Scott

Answers


You can't use pre-existing *.so files because they need to be compiled for Android. In order to create an *.so for Android you need to use their NDK, which is already set up to build the correct format so you don't need to worry about arm-none-linux-gnueabi or anything. If you want to use a library that isn't available on Android you'll need to build it yourself using the NDK. I had to do this with the STL.


Please refer to the following :

Can i use the native libraries (installed in android stack) in my NDK application?

This should answer you some queries...


Need Your Help

Android GridView Reversing After Handling Orientation Change

android gridview screen-orientation

EDIT: This problem may be related to BaseAdapter causing ListView to go out of order when scrolled

Can I use the same android keystore file in mac android studio which is generated by eclipse and windows7

eclipse macos android-studio windows-7-x64 android-keystore

I have one old keystore file generated by eclipse in windows 7 to release my app. Now I've migrated to android studio in mac OS. It shows the error "Keystore was tampered with or password was incor...