Cocos new -t binary yields "Template 'binary' is not found"

Cocos new -t binary yields "Template 'binary' is not found"
0.0 0


I have Cocos2d-x 3.13.1 and successfully pre-built the library for every platform. When I do this:

cocos new game -p -l cpp -t binary

I get:

Template named 'binary' is not found.
Multiple templates detected!
You can select one via -t arguments.
Or choose one now:

1 default
Select one (input number and press enter):

Any ideas?


I don’t believe there’s a pre-built template available yet? There should be, however, and ideally with a selection of the versions you have prebuilt.



I’m having the same problem.

I’m following this guide to set it all up. I’m using the head of v3 branch. I basically done:
$ git clone
$ cd cocos2d-x
cocos2d-x $ python
cocos2d-x $ git submodule update --init
cocos2d-x $ ./
cocos2d-x $ cocos gen-libs -c -ap android-25

I now have three folders under cocos2d-x/prepbuilt:
ios, mac and android

When I now do:
cocos2d-x $ cocos new binary-test -p -l cpp -d . -t binary

I get:
"Template named ‘binary’ is not found.
Multiple templates detected!
You can select one via -t arguments.
Or choose one now:

1 default
Select one (input number and press enter):"

And looking under template folder there is only one: default.

So how do I generate a project with the prebuilt libraries?




cocos gen-templates

Then the rest of the steps.


Ok thanks. I see now that command is listed at the very end in this guide:

Maybe it should be listed a bit clearly under “Creating pre-built libraries to use instead of source code.” or under “Using the pre-built libraries in your projects.” It’s easy to miss.



It’s not really the correct way. It is a deprecated way but still works. There isn’t a new way currently.


How can it be deprecated if there is no new way? :smile:

In my understanding there is a way1, when there is a new better way2, the way1 become deprecated.


Deprecated doesn’t mean there is a replacement. -t was a Cocos Studio flag and we don’t write this product any longer.


Honestly if none of these work well for you I’d suggest learning how to use pre-built libraries for each platform separate from cocos2d-x. So search “xcode static libraries”, “android studio gradle static libraries”, “cmake static libraries”, “win32 …”, etc. For the most part if you just build the library itself (open the platform’s project: cocos2d_libs.xcodeproj, etc), learn how to build static/dynamic library, then create a new project (or use cocos create) and learn how to link with a static/dynamic library separately (you can delete the cocos2d folder copied over as the normal template.

I think this will help you in the long-run if you are a programmer and want to learn build processes for future projects.



Oh, now I understand. Thank you!



DId something changed with cocos2d-x-3.15.1 ?
When I run cocos gen-templates on OSX I get:

Python 2.7.10
Error: argument ‘gen-templates’ not found.
Try with cocos -h

cocos -v
Python 2.7.10
Cocos Console 2.3

cocos -h
Python 2.7.10

/Applications/Cocos/cocos2d-x/tools/cocos2d-console/bin/ 2.3 - cocos console: A command line tool for Cocos2d-x.

Available commands:
run Compiles, deploy and run project on the target.
gen-libs Generate prebuilt libs of engine. The libs will be placed in ‘prebuilt’ folder of the engine root path.
luacompile Encrypt and/or compile lua files.
deploy Compile and deploy a project to a device/simulator.
package Manage package for cocos.
compile Compile projects to binary.
gen-simulator Generate Cocos Simulator.
new Creates a new project.
jscompile Compile and/or compress js files.

Available arguments:
-h, --help Show this help information.
-v, --version Show the version of this command tool.
–ol [‘en’, ‘zh’, ‘zh_tr’] Specify the language of output messages.
–agreement [‘y’, ‘n’] Skip the agreement with specified value.

cocos new --help
cocos run --help


gen-templates was used with Cocos Studio really. There isn’t a need for this now.


The instructions here are broken then:

And the reference to gen-templates here is wrong too:

Where can I edit that page to reflect the change? The github link on it goes to a 404.


These changes are already fixed in the next docs release.


Could you paste in the new way of doing things from those docs?

When are those docs being released?


We are also talking about this in another thread.

The new docs will come out in a few weeks. I put up beta versions here:, although I probably should put up a new beta, this one is weeks old.


Thanks. Yes, these still say you can do things that don’t work like:

cocos new MyGame -p com.MyCompany.MyGame -l cpp -d ~/MyCompany -t binary

(-t binary is the broken part)


cocos gen-templates



I’ll update the build.


Did you update the build? I haven’t use prebuild library and gen-templates