Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Android native code target multiple processor types?

From what I understand, native code on Android is code that works directly with the processor of a specific device. So if I wanted to take advantage of a certain processor I would use native code.

But what happens if I want to make an app that contains native code, but targets multiple processors?

Do I have to make multiple apps, one for each architecture? Or is there a way to put multiple version of the native code in one app picking the one matching the processor of the device it runs on?

like image 342
JumpJump Avatar asked Sep 30 '22 21:09

JumpJump


1 Answers

The Android Native Development Kit is a suite of cross compilers and support libraries which can be used to produce shared object (.so) files targeting one or more of the officially supported Android architectures.

The Android application package (.apk) specialized zip file format allows inclusion of distinct native libraries for more than one architecture.

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

like image 115
Chris Stratton Avatar answered Oct 05 '22 12:10

Chris Stratton