When programming on c ++ for android, do you need to write code specifically for each processor (snapgragon, exynos, atom)?

Closed due to the fact that it is necessary to reformulate the question so that you can give an objectively correct answer to the participants of D-side , Grundy , Nicolas Chabanovsky 30 May '16 at 8:38 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    The code must be compiled specifically for each architecture - arm, x86, mips, and not the processor model.

    Including, therefore, Android on a virtual machine, which supports several architectures without the need to compile for each of them. Java code is universal when compiling, and C ++ code is architecture-dependent.

    On the other hand, it is not clear what claims you have against the Android operating system. On any C ++ platform, the code depends on the architecture on the client machine.

    • It turns out if you write using ndk then the code will be either for the arm or for x86? - Eldar Eldar
    • @EldarEldar The code will be in C ++ - this is a high-level language, and from the source code in C ++ you can compile the executable file both under the arm and under the x86. If there are two compiled modules in the package (under arm and under x86), then your code will work on the arm architecture and on the x86 architecture. On assembly under different architectures read off.documentation . And in general, if you took it, make an effort to start at least an official guide to study the NDK. Everything is written there, but please contact here for specific problems. - pavlofff