androidandroid-studioandroid-ndkcocos2d-xcocos2d-android

Getting error: Execution failed for task : myApp:compileDebugNdk'


Hi I am trying to run an app created with Cocos2d-x 2.5 with Android Studio but I keep getting this error when running the project:

:myApp:compileDebugNdk AGPBI: {"kind":"ERROR","text":"*** Android NDK: Aborting... . Stop.","sourcePath":"/mypath/ndk/android-ndk-r10d/build/core/add-application.mk","position":{"startLine":199},"original":""}

FAILED Execution failed for task ':myApp:compileDebugNdk'.

Building works ok. I have Android Studio 1.1.0 and a Mac with OS X Yosemite 10.10.

Do you guys have any idea what could be wrong?

I have seen a similar error being discussed here Execution failed for task ':app:compileDebugNdk' when trying to compile Android Studio project with NDK source code

but the solution doesn't work for me (created an empty .c file in the jni folder). It looks like that is something that happens on Windows and I use Mac.


Solution

  • I solved it adding this to the build.gradle file:

    sourceSets.main {
       jni.srcDirs = []
    }