I can solve a similar problem like this one. I am running Cocos2d-x v3.6 and may have this error on both the N9 r9d and r10e NDKs. Whenever I ran android-build.py from the cpp-tests folder, I always got this error:
cocos compile -p android -s C: \ Cocos2d-x \ cocos2d-x-3.6 \ build .. \ tests / cpp-tests -ndk-mode debug Run the command: compilation Build mode: debug Android platform is not specified, search by by default ... It is not possible to find a suitable android platform for the project: "C: \ Cocos2d-x \ cocos2d-x-3.6 \ tests \ cpp-tests \ proj.android". The Android platform must be equal to / greater than 10. It is not possible to build a dynamic library for the project [C: \ Cocos2d-x \ cocos2d-x-3.6 \ build .. \ tests / cpp-tests]!
Also, this error also appears when I tried to create a project and run build_native.py from the project itself.
I can understand, perhaps because ANT_ROOT, NDK_BUILD and ANDROID_SDK_ROOT are not registered in the cocos command properly.
Here is what I did:
- I deleted all Cocos2d-x related environment variables (ANT_ROOT, NDK_BUILD and ANDROID_SDK_ROOT).
- I went into the root folder of Cocos2d-x and ran setup.py again
- This time Cocos2d-x asks for new paths (since we deleted them)
- I added the path manually, and then restarted the console.
I went ahead and tried this tutorial .
I got a slightly different output message than the screen. I did not succeed, but at least I no longer have an error that says that the Android platform is not listed.
UPDATE: It seems that the error was caused by ANT_ROOT. Here's the hard part. You specify ANT_ROOT without ; or \ at the end of the path when pasting the path My Computer> Right Click> Properties> Advance System Settings> Environment Variables (Assume you are using windows). The cocos construct adds an extra directory from ant and actually destroys the actual path at build time. Replacing it manually and then rebooting the console will return to where I was before. I just did what I did a while ago (removing the entire environment variable related to Cocos2d-x, this time, including ANT_ROOT), and it works! I can build apk and run it on my phone!
Hope this helps someone in the future.
source share