8
votes

I'm trying to build an Android projects which involves NDK: CoolMicApp-Android (already have the latest Android Studio and NDK installed)

I followed the BUILDING note correctly. When the project is loaded in Android Studio, there are some errors:

Build command failed.

Error while executing 'C:\Users\Cipta-NB\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd' with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Cipta-NB\StudioProjects\CoolMicApp-Android\app\src\main\jni\Android.mk NDK_APPLICATION_MK=C:\Users\Cipta-NB\StudioProjects\CoolMicApp-Android\app\src\main\jni\Application.mk APP_ABI=armeabi NDK_ALL_ABIS=armeabi NDK_DEBUG=0 APP_PLATFORM=android-16 NDK_OUT=C:/Users/Cipta-NB/StudioProjects/CoolMicApp-Android/app/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Users\Cipta-NB\StudioProjects\CoolMicApp-Android\app\build\intermediates\ndkBuild\release\lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}

Android NDK: INTERNAL ERROR: The armeabi ABI should have exactly one architecture definitions. Found: ''

process_begin: CreateProcess(NULL, "", ...) failed.

*** Android NDK: Aborting... . Stop. Open File

The C libs can be built successfully by running this command, though:

ndk-build NDK_APPLICATION_MK=C:\Users\Cipta-NB\StudioProjects\CoolMicApp-Android\app\src\main\jni\Application.mk NDK_PROJECT_PATH=C:\Users\Cipta-NB\StudioProjects\CoolMicApp-Android\app\src\main

In my laptop, ndk-build is located in C:\Users\Cipta-NB\AppData\Local\Android\Sdk\ndk-bundle. Creating an environment variable called NDK_PROJECT_PATH and restarting Android Studio doesn't solve the problem.

This is the content of local.propertes file in the project directory:

ndk.dir=C:\Users\Cipta-NB\AppData\Local\Android\Sdk\ndk-bundle

sdk.dir=C:\Users\Cipta-NB\AppData\Local\Android\Sdk

And this is the content of Application.mk

APP_ABI := armeabi-v7a

APP_PLATFORM := android-14

Is there any (easy) workaround?

1
Which exact version of the NDK are you using? The latest version (r17) no longer supports armeabi as a target. Build for armeabi-v7a and/or arm64-v8a instead.Michael
NDK version: v17.0.4754217 (provided by SDK Manager). BTW, I just updated my question a bit. My build target s armeabi-v7a.anta40
Try adding abiFilters in your build.gradle since you're only building for one abi.Mikhail Vasilyev
Hmm... I modified my gradle.properties and build.gradle (based on stackoverflow.com/questions/32487192/…). Well still the same error.anta40
You don't need to modify gradle.properties, just put ndk{abiFilters 'armeabi-v7a'} inside defaultConfig in build.gradle as described here. From your output it is clear that gradle overrides APP_ABI and sets it to armeabi which is deprecated as pointed out by Michael.Mikhail Vasilyev

1 Answers

6
votes
  1. NDK_PROJECT_PATH=null is a red herring. It only looks alarming. It's not an error. This is how NDK build is configured in Android Studio.

  2. The latest NDK r17 dropped support for some ABIs. Unfortunately, the old Gradle plugin does not know that. You can resolve this inconsistency by tuning your build.gradle script, but upgrading the plugin is easier and safer.