How to target multiple architectures using NDK?

核能气质少年 提交于 2019-11-30 05:58:49
Alex Cohn

If you don't set APP_ABI at all, or use

APP_ABI := all

in your Application.mk, then ndk-build will build for all architectures supported by your version of NDK. The latest one, to date r8d, will in addition to armeabi armeabi-v7a x86 build also for mips. When another architecture will be released, you will hopefully automatically get the APK built to support it.

When you application is installed on an Android device, the system will automatically choose the matching ABI version and install the correct shared libraries from the APK.

One drawback of this approach is that if the native libraries are big, your "monolithic" APK file may become huge. You can use the multi-APK approach to make user downloads smaller. The official site recommends: You should generally use multiple APKs to support different device configurations only when your APK is too large (greater than 50MB). You should carefully follow the version code guildlines if you choose this route.

Unfortunately, there are no trustworthy prophecies regarding NDK support on Google TV, but there seem to be no technical justification for its current unavailability. If and when it arrives, your ndk-build will take care of it automatically.

UPDATE Here is a simple process to maintain split APK. And by the way, the new Android TV does support NDK.

For the latest version (now r9) you have to specify in "jni/Application.mk"

APP_ABI := all

or

APP_ABI := armeabi armeabi-v7a x86 mips

without ./ndk_build will only build 'armeabi'

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