Android build problem on windows cocos2dx C++

Hi.
I created a new project and I have setup everything like SDK, NDK, ANT…
So when I want to build android project in cmd I enter: cd project/cocos2d/build and then run android-build.py. Here is the error:

C:\Users\mr.Clon3R\Desktop\dude\org.cocos2dx.mine\cocos2d\build>android-build.py

Usage:
    This script is mainy used for building tests built-in with cocos2d-x.

    Usage: android-build.py [options] [cpp-empty-test|cpp-tests|lua-empty-test|l
ua-tests|cpp|lua|all]

    If you are new to cocos2d-x, I recommend you start with cpp-empty-test, lua-
empty-test.

    You can combine these targets like this:

    python android-build.py cpp-empty-test lua-empty-test



Options:
  -h, --help            show this help message and exit
  -n NDK_BUILD_PARAM, --ndk=NDK_BUILD_PARAM
                        It is not used anymore, because cocos console does not
                        support it.
  -p ANDROID_PLATFORM, --platform=ANDROID_PLATFORM
                        This parameter is not used any more, just keep
                        compatible.
  -b BUILD_MODE, --build=BUILD_MODE
                        The build mode for java project,debug[default] or
                        release. Get more information,please refer to
                        http://developer.android.com/tools/building/building-
                        cmdline.html

Then I tried cocos2d deploy commands but cmd says android platform not specified. I enter : cocos deplosy -s (root) -p android -m release.
And I added --ap android-20, Then it says can’t find android-20 SDK!

Please help me guys. Thank you so much.

Anyone anything? :unamused:

Did you install android-20 sdk?

I think so…

Hello @clon3r

This is not how you build your android project.

android-build.py

command is used to build the cpp-test

In order to build your android game.

  • Go inside your game project folder.
  • Go inside proj.android folder.
  • Run the command - build_native.py -p 20 // where 20 is your android SDK version.

After successful build, you will find your .apk file inside proj.android/bin
Hope that helps.
Happy Coding :smile:

1 Like