Build Error:Execution failed for task ':CppTests:externalNativeBuildDebug'

Hi,

I’m trying to compile the CppTests in AndroidStudio and getting the error :

Error:Execution failed for task ':CppTests:externalNativeBuildDebug'.
> Unexpected native build target cpp_tests. Valid values are: 

Additionally, output from the Gradle console shows :

Configuration 'compile' in project ':CppTests' is deprecated. Use 'implementation' instead.
AGPBI: {"kind":"warning","text":"Targeted device ABI or comma-delimited ABIs [x86] is not one of [armeabi]. Nothing to build.","sources":[{},{}]}

Here’s my setup :

  • Windows 7 Pro 64 bit
  • Cocos2d-x v3.16
  • Python 2.7.12
  • NDK r16b
  • Android Studio v3.0.1
  • jdk1.8.0_91
  • jre1.8.0_161

I’ve tried two virtual devices as targets : Pixel running API 23, and a Nexus 5 running API 26 (both of which appear to be x86)

I’m just trying to open and compile the CppTests using AndroidStudio. I’ve been trying to follow the instructions for AndroidStudio at http://cocos2d-x.org/docs/cocos2d-x/en/installation/Android-Studio.html I believe I have all of the prerequisites (I don’t have Visual Studio installed, but at this point I’m just targeting Android devices)

I’ve seen reference to installing the older NDK 10e instead, but the prerequisites on the page above say that NDK 11+ should be ok, but so far I’ve not been able to make it work.

If you use the v3.16 code from cpp-tests just change this line from

APP_ABI := arm

to

APP_ABI := armeabi-v7a x86

Hope this will help for you.

Thanks for the suggestion, but it appears to have made no difference. (I am using v3.16.)

The code your link points to is the Android.mk file, but I think you meant to link to the Application.mk file. Changing the file as you suggested still results in the same error :

Error:Execution failed for task ':CppTests:externalNativeBuildDebug'.
> Unexpected native build target cpp_tests. Valid values are: 

Not sure if this provides anything useful, but I also see this output in the Gradle console :

Configuration 'compile' in project ':CppTests' is deprecated. Use 'implementation' instead.
AGPBI: {"kind":"warning","text":"Targeted device ABI or comma-delimited ABIs [x86] is not one of [armeabi]. Nothing to build.","sources":[{},{}]}
Configuration 'compile' in project ':libcocos2dx' is deprecated. Use 'implementation' instead.

You’re right. I linked to the wrong file. Has you also tested it changing here?

I did try changing it there and saw no change. Still stuck.

I had the same issue and fixed it by changing gradle.properties file:

PROP_APP_ABI=armeabi:x86

(Was just armeabi.)

1 Like

Thanks! That seems to have done the trick.