Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cross-plattform use of a static .a-library on iOS and Android possible? (what about .so and .dylib ?)

I have created a static library (with extension .a) for iOS with Xcode. These were my build-settings:

  • Architectures: armv6, armv7
  • Base SDK: iOS 4.3
  • Build Active Architecture Only: No
  • Supported Platforms: iphoneos, iphonesimulator
  • Valid Architectures: armv6, armv7

A check with lipo -info libassimp.a approves: Architectures in the fat file: libassimp.a are: armv6 armv7

Can I use this static .a-library in an Android NDK project as well? Do I have to add supported platforms? Or do I have to build it seperately on Android?

Furthermore, I need libz.dylib which is a preinstalled library on iOS - actually libassimp.a needs libz.dylib. Is it also available on Android, and would it be possible to use libassimp.a without modifications on Android in this case?

like image 791
j00hi Avatar asked Jan 19 '26 16:01

j00hi


1 Answers

You need to separately compile the library for Android platform. A simple example of compiling C-C++ sources for Android platform is given in the link below

http://tariqzubairy.wordpress.com/2012/03/09/arm-binaries-static-library-for-android/

For using the already pre-build version of any library on Android you just need to add a local module in your Android.mk file as given in the link below

http://tariqzubairy.wordpress.com/2012/03/12/use-of-prebuild-static-library-compiled-with-android-toolchain/

like image 137
TMZ Avatar answered Jan 21 '26 06:01

TMZ