Android Native – When to use 64-bit NDK?

According to NDK’s official download page: http://goo.gl/vI7Oek
there are two target versions:

  • x86 Target
  • x64 Target

And I was wondering ( as a newbie in the NDK stuff ), does this mean I should use the x64 NDK when compiling an application for devices equipped with x64 processors?

  • Which Eclipse for Android?
  • Use 32-bit jni libraries on 64-bit android
  • Unable to install Android Studio in Ubuntu
  • Android SDK suddenly stopped working
  • How to make Android's aapt and adb work on 64-bit Ubuntu without ia32-libs (works for versions 12, 13 and 14)
  • android studio adb Syntax error: “)” unexpected
  • And if I need only one “.apk” file, how to make it contain both x86 & x64 builds? ( if possible of course )

    Related posts:

    Integrating the ZXing library directly into my Android application
    Android embedded HTML5 video
    SwitchPreference and CheckBoxPreference in code
    Android Dagger Dependency Injection fails on private Fields
    Android 2.2 and “Bad address family” on Socket Connect
    How to get size of a custom dialog in android?
  • Android SDK suddenly stopped working
  • SDK Manager won't start Windows 7 64-bit?
  • android studio adb Syntax error: “)” unexpected
  • Android adb doesnt recognize Samsung Galaxy S (I9000) on Windows 7 64 bit
  • Which Eclipse for Android?
  • Unable to install Android Studio in Ubuntu
  • One Solution collect form web for “Android Native – When to use 64-bit NDK?”

    Update: The question is a bit outdated now. Starting from version 10c NDK is distributed in a single package for all target platforms again. 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 can be ARM (several kinds) 32 or 64 bit, MIPS 32 or 64 bit, and Intel x86 / x64) and the architecture/OS of your build machine (which can be Windows, Linux or Mac all running on Intel x86 / x64 processors).

    So suppose you have Windows 64 bit. Then (as right now the latest version is 10d) you should download android-ndk-r10d-windows-x86_64.exe. It will allow you to build for all target platforms supported by NDK (32 and 64 bit).

    If you build for 32-bit target device, the application will run on 64-bit device as well, because all listed 64-bit architectures are backward compatible with their 32-bit counterparts.

    But if you want to use 64-bit specific features of target architecture, you should use 64-bit toolchains. If you build only for 64 bits, the application won’t run on 32-bit architecture.

    If you have to support several targets (like ARM and Intel x86), in your Application.mk you can specify targets which you want your native code to be built for (google for APP_ABI), so you’ll build several versions of native library and the system will load the appropriate one in runtime. Also this way you can provide separate binaries for 32 and 64 bit versions of same architecture family, so you may fine-tune them.

    You may further read the docs inside NDK package, they are quite exhaustive.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.