Prebuilt generation not working in 3.13.1 and 3.11.1

@zhangxm no i dont update console, just use console that comes with cocos

But i checked v3.13.1, the cocos console doesn’t include the codes that cause the error. It should be like this.

Edit: i mean the file content of tools/cocos2d-console/plugins/plugin_compile/build_android.py.

@zhangxm ok i need to check

If you use github repo, you can easily check out correct commit. If not, you can clone cocos console and replace the codes. The commit used in cocos2d-x v3.13.1 is here.

I’ve installed it, and not it’s asking same but now for android-13. I want to use android-19 and up. I don’t need lower devices.

Working with simple cocos2d-x project on my macOS hackintosh PC Intel Core i3 with SSD extremely slow! Compilation and indexing in Xcode is about 5 min. Building libs for macOS, iOS is about 25 min.

I’m following getting started tutorial from here - http://cocos2d-x.org/docs/editors_and_tools/cocosCLTool/
To save my time. I’m not using cocos studio, because it’s bad as all editors ever made and provided by cocos2d-x. Normal editor should work and be like SpriteBuilder… Why you don’t use it! If dev’s developing cross-platform games they would need to use macOS anyway.

Thats nice to hear after my 3 days of struggling to just get started with cocos2dx lol.
As I see guys you documentation is outdated, many things doesn’t work. I believe many many new developers that just tried all this dummy docs just gave up finally. But NOT me lol/

I just downloaded cocos2d-x from main site in downloads section, so there is no git or something.

Thats helps! Thanks! By the way - in first file there is anroid-10 and in the second android-13.
Thats why - this

isn’t worked.


Hurray! Libs compiled for android! On the 4th day or more even… I missing counting already - I finally compiled android libs on my macOS. Thanks god and dev’s here :slight_smile:

I’m afraid to imagine what to do next and how to read the documentation if all outdated and nothing is clear and missed at all.

So, now I want to open my android project and develop game in it. Which IDE for android on my Mac should I use? How to add in-apps, additional SDK’s like Flurry or unity ads? Or some specific android code, like game center? What next steps for me as new developer here? How to debug my code on android? Well, all typical question for developing of games…

p.s. compiling iOS libs is wrong(my main target is android, but anyway), libs compiled in debug mode - can’t compile iOS project. Info here - Need help getting started with Cocos2d-x to build for iOS & android But if libs compiled in release mode - I can compile project.

All right, I tried to move next a little bit. Assuming that now I have compiled libs for android.
So, I wanna create a new project:

cocos new ProjectName -p projectname.com.name -l cpp -t binary

And execute:

cocos compile -p android -m debug

As usually - it’s not compiling. :slight_smile: I would be surprised if something should just work.

Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Android NDK: /Volumes/MacData/CocosX/cocos2d-x-3.13.1/cocos/./prebuilt-mk/Android.mk: Cannot find module with tag ‘android/cpufeatures/prebuilt-mk’ in import path
Error running command, return code: 2.

@zhangxm @zhangbin ? What I should change to be able to compile? And also I should ask: is this a bug?

The command is created for Cocos Studio, and there is a corresponding template for it. But as Cocos Studio is canceled, so the template is not maintained any more. I would suggesting not using prebuilt libs or you should modify the project setting yourself.

@zhangxm now project build fine, thanks, how did you update tools like cocos-console, is that submodules at repo ?

Yep, it is a submodule of cocos2d-x.

Not using prebuilt libs is really pain. I’m using Xcode only and really want to use only it.
I have hackintosh with Core i3 and SSD and new project using full source code building time is about 5 min. Also very slow indexing of the project. My xcode folder “DeliveredData” is really heavy after Xcode opens simple project. Also, if I want to clean up project it’s rebuild lib again and again. So that’s why using prebuilt libs really save my time.

And so, if this template is cancelled why documentation http://cocos2d-x.org/docs/editors_and_tools/cocosCLTool/ doens’t warning about that? @slackmoehrle :slight_smile: ?

However, I’ve found solution to build libs:
In file prebuilt-mk/Android.mk just removed line -$(call import-module, android/cpufeatures/prebuilt-mk)

@zhangxm Build succeed. But thats ok that I did that? Removed that line?

Yeah. Honestly prebuilt should be the default. Most shouldn’t modify the engine. A dual target template could also be created that supports both.

It should check that prebuilts (and latest dependencies) exist and if not download from the prebuilt for common OS/arch/binaryformat in the same way many many oss projects do it.

Prebuilt Binaries should exist on GitHub releases wiki page or sourceforge for each version using auto build machine.

The default prob would still be copy source cocos folders like it does now. That way prebuilt is opt in for 3.x.

Obviously some want specific compile flags so a default normal flags in a debug and release mode would be created. Or even just prebuilts for debug only. Use source for release.

Maybe I’m off base here but we do something in the realm of what I’ve written and it streamlines many things. strong text

@zhangxm Any ideas?

What’s the full path of prebuilt-mk/Android.mk? What’s the error if you didn’t remove that line?

This: cocos2d-x-3.13.1/cocos/prebuilt-mk

@zhangxm Here is situation just to clarify what I’m doing from the beginning:

I downloaded latest cocos2d-x http://www.cocos2d-x.org/filedown/cocos2d-x-3.13.1.zip

Set up all things and tried to compile libs for android:

cocos gen-libs -c -p android -m debug

Out of the box doesn’t compiles. Here is an error:

Also for iOS in debug mode after creating project using libs -it’s wont compile, but I’ve found solution for that.

But later this helped me

I modified these files and got build of android libs.

Then I created a new project:

cocos new ProjectName -p projectname.com.name -l cpp -t binary

And tried to compile it:

cocos compile -p android -m debug

And got this:

Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 9 in ./AndroidManifest.xml
Android NDK: /Volumes/MacData/CocosX/cocos2d-x-3.13.1/cocos/./prebuilt-mk/Android.mk: Cannot find module with tag ‘android/cpufeatures/prebuilt-mk’ in import path

This error bellow is answer for your question:

@zhangbin @zhangxm How I can fix this? :slight_smile:

In fact, the binary template is for Cocos Studio. Please don’t use option -t binary in command cocos new.

@slackmoehrle Could you please update the document to remove the -t binary option in step cocos new? Thanks very much!

Ok I can do that.

But I want to use libs and Android Studio. It’s possible. And also I want and successfully used prebuilt libs for iOS target. Removing -t binary is very bad idea…

upd.: I’ve found solution fix line in prebuilt-mk/Android.mk here thanks to @zhangxm - Can not build project with cocos 3.13.1

$(call import-module, android/cpufeatures)


cocos compile -p android -m debug
BUILD SUCCESSFUL.

Now I can create project using prebuilt libs and build it for android. But haven’t tested it yet on real device… need to buy something.

Now, next step - use Android Studio for development! What about this - Cocos2d-x v3.12 released! ?

today, I built the pre-builts using v3.13.1 and I didn’t have any trouble. Clean virtual machine, using OS X.

@zhangbin can you tell me how a user creates a new project with cocos new ... using the pre-built libraries without the -t flag? I can’t seem to make this happen. I can if I use the old Cocos Launcher.

No please… too much info… :slight_smile: - I mean - what you did exactly? What downloaded, installed, which command did you run etc. Just from the beginning I got error “android-10” can’t be found.