- Android NDK Game Development Cookbook
- Sergey Kosarevsky Viktor Latypov
- 190字
- 2021-07-21 18:21:23
Supporting multiple CPU architectures
Android NDK supports different CPU architectures such as ARMv5TE and ARMv7-based devices, x86, and MIPS (big-endian architecture). We can create fat binaries that can run on any of the supported platforms.
Getting ready
Find out the architecture of your Android-based device. You can do it using the adb
command as follows:
>adb shell cat /proc/cpuinfo
How to do it...
The following are the two approaches to pick an appropriate set of CPU architectures:
- By default, the NDK will generate the code for ARMv5TE-based CPUs. Use the parameter
APP_ABI
inApplication.mk
to select a different architecture, for example (use only one line from the following list):APP_ABI := armeabi-v7a APP_ABI := x86 APP_ABI := mips
- We can specify multiple architectures to create a fat binary that will run on any of them through the following command:
APP_ABI := armeabi armeabi-v7a x86 mips
There's more...
The main pitfall of the fat binaries is the resulting .apk
size, as separate native code versions are compiled for each of the specified architectures. If your application heavily uses third-party libraries, the package size can become an issue. Plan your deliverables wisely.
推薦閱讀
- Learning AngularJS Animations
- Deep Learning with PyTorch
- 從零開始學51單片機C語言
- Artificial Intelligence Business:How you can profit from AI
- 分布式微服務架構:原理與實戰
- 單片機系統設計與開發教程
- 超大流量分布式系統架構解決方案:人人都是架構師2.0
- Neural Network Programming with Java(Second Edition)
- 電腦組裝與維護即時通
- 圖解計算機組裝與維護
- 3D Printing Blueprints
- Arduino項目開發:智能生活
- Mastering Quantum Computing with IBM QX
- USB應用分析精粹:從設備硬件、固件到主機端程序設計
- 計算機組裝、維護與維修項目教程