Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to ndk setting finished with non-zero exit value 2 on android?

I want to build Gstreamer source and it needs NDK.

I am setting SDK Manager -> Android SDK -> SDK Tools -> NDK install

and I set local.properties dk:dir="C\:\\Users\\ddd\\AppData\\Local\\Android\\sdk\\ndk-bundle.

After setting ndk, I try to build it, but execution failed.

Execution failed for task ':app:ndkBuild'. > Process 'command 'C:\Users\ddd\AppData\Local\Android\sdk\ndk-bundle\ndk-build.cmd" finished with non-zero exit value 2 message.

How to set ndk on android?

like image 950
chohyunwook Avatar asked Feb 27 '17 07:02

chohyunwook


1 Answers

To find the specific issue, check the Build tab in Android Studio to see which task is failing. For me it was task "cleanNative".

Then run this task manually from Terminal with --debug option.

On Mac or Linux:

./gradlew cleanNative --debug

On Windows:

gradlew cleanNative --debug

From logs, you can then see why it is failing. In my case it was the wrong ABI settings:

10:24:27.140 [QUIET] [system.out] Android NDK: The armeabi ABI is no longer supported. Use armeabi-v7a.    
10:24:27.140 [QUIET] [system.out] Android NDK: NDK Application 'local' targets unknown ABI(s): armeabi    
10:24:27.140 [ERROR] [system.err] /Users/michal-home/Library/Android/sdk/ndk-bundle/build/core/setup-app.mk:79: *** Android NDK: Aborting    .  Stop.
10:24:27.140 [QUIET] [system.out] Android NDK: Please fix the APP_ABI definition in /path-to-app/app/src/main/jni/Application.mk    
like image 151
Micer Avatar answered Oct 10 '22 21:10

Micer