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

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

#1

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

cocos new game -p com.company.game -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?


#2

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.


#3

Hey,

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 https://github.com/cocos2d/cocos2d-x.git
$ cd cocos2d-x
cocos2d-x $ python download-deps.py
cocos2d-x $ git submodule update --init
cocos2d-x $ ./setup.py
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 com.company-binary-test -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?

/D


#4

Run

cocos gen-templates

Then the rest of the steps.


#5

Ok thanks. I see now that command is listed at the very end in this guide: http://cocos2d-x.org/docs/editors_and_tools/cocosCLTool/

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.

/D


#6

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


#7

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.


#8

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


#9

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.

2c


#10

Oh, now I understand. Thank you!


#11

Hi,

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
cocos2d-x-3.15.1
Cocos Console 2.3

cocos -h
Python 2.7.10

/Applications/Cocos/cocos2d-x/tools/cocos2d-console/bin/cocos.py 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.

Example:
cocos new --help
cocos run --help


#12

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


#13

The instructions here are broken then: http://www.cocos2d-x.org/docs/editors_and_tools/cocosCLTool/index.html#using-the-pre-built-libraries-in-your-projects

And the reference to gen-templates here is wrong too: http://www.cocos2d-x.org/docs/editors_and_tools/cocosCLTool/#unique-command-line-options

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


#14

These changes are already fixed in the next docs release.


#15

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

When are those docs being released?


#16

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: slackmoehrle.github.io, although I probably should put up a new beta, this one is weeks old.


#17

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)

and:

cocos gen-templates

Here:
http://slackmoehrle.github.io/en/editors_and_tools/cocosCLTool.html


#18

I’ll update the build.


#19

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