Enabling Neon Intrinsics support

In this section we will look at enabling Neon Intrinsic support in Android Studio. To enable support for Neon intrinsics, we must modify the ABI filters & so the app can be built for the Arm architecture. There are two versions of Neon:

  • Neon forArmv7, Armv8 AArch32
  • Neon for Armv8 AArch64.

From an intrinsics point of view, there are a few differences, like the addition of vectors of 2xfloat64 in Armv8-A. Both versions are available in the arm_neon.h header file that is included in the compiler installation path. You also must import the Neon libraries.

  1. Go to the Gradle scripts. 
  2. Open the build.gradle (Module: app) file.
  3. Then, supplement the defaultConfig section by adding the following statements.

First, add this line of code to the general settings:


The code should look like this

defaultConfig {

   applicationId "com.example.myapplication"

   minSdkVersion 16

   targetSdkVersion 29

   versionCode 1

   versionName "1.0"

   ndk.abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'

   testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild { cmake { cppFlags "" arguments "-DANDROID_ARM_NEON=ON" } } }

Now you can use Neon intrinsics, which are declared within the arm_neon.h header. The build will only succeed for Arm-v7 and later. To make your code compatible with x86, use the Intel porting guide.

Previous Next