问题
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?
回答1:
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/
来源:https://stackoverflow.com/questions/7042705/cross-plattform-use-of-a-static-a-library-on-ios-and-android-possible-what-ab