c++ - Android Native - When to use 64-bit NDK? -
According to the official download page of NDK: Two target versions are:
- x86 target / li>
- x64 target
And I was thinking (as a newbie in NDK stuff), does it mean that I should use x64 NDK, when an application for devices equipped with X64 processor is compiled?
And if I only need one ".apk" file, how can it be included in XML? Makes x64? (If possible)
Update: The question is a bit old now . Start from version 10c
. The answer has been updated to reflect this fact.
First of all, you should distinguish between the architecture of the device where your application will run (which is ARM (32 types) or 64 bit, MIPS 32 or 64 bit, and Intel x86 / x 64) and the Architecture / OS of your build machine (which can be all Mac running on Windows, Linux or Mac Intel x86 / x64 processors).
Assume that you have Windows 64 bit then (the latest version is still in the form of 10d
) you android-ndk-r10d-windows-x86_64.exe
should download. This will allow you to create for all target platforms supported by NDK (32 and 64 bit).
If you create a 32-bit target device, the application will also run on 64-bit devices, because all listed 64-bit architectures are backward compatible with their 32-bit counterparts.
But if you want to use the 64-bit specific attributes of the target architecture, then you should use 64-bit toolchains if you only create for 64 bit, then the application is 32-bit architecture But will not run.
If you want to support multiple targets (such as ARM and Intel x86) in your Application.mk
, you can specify those targets, You want to create the code for google for APP_ABI
, so that you will create multiple versions of the native library and the system will load one in proper order. Along with that you can provide different binaries for 32 and 64 bit versions of the same architecture family, so that you can fix them.
You can read more documents inside the NDK package, they are quite popular. / P>