How can native Android code work with several types of processors?

From what I understand, native code on Android is code that works directly with the processor of a specific device. Therefore, if I wanted to use some processor, I would use my own code.

But what happens if I want to create an application that contains its own code but is designed for multiple processors?

Do I need to make several applications, one for each architecture? Or is there a way to put several versions of native code in one application by choosing one that matches the processor of the device on which it works?

+4
source share
3 answers

The Android Native Development Kit is a collection of cross-compilers and support libraries that can be used to create shared object (.so) files that target one or more officially supported Android architectures.

A special package of zip files for Android applications (.apk) allows you to include separate native libraries for more than one architecture.

If you refer to the NDK documentation, you will see that there is a project configuration file that you can use to specify the architecture (s) that your own code must be compiled for support.

+4
source

-. , X, Y. CPU Y, X, .

0

, NDK. "Application.mk" jni. APP_ABI = : APP_ABI: = x86 armv7eabi mips APP_ABI: = all ( apk ) FAT Google Play, apk , .

0

Source: https://habr.com/ru/post/1538882/


All Articles