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

两盒软妹~` 提交于 2020-01-04 02:14:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!