Prebuilt generation not working in 3.13.1 and 3.11.1

@crittergorge @anon98020523 @camkadev why did you use cocos gen-libs? Did you use Cocos Studio, or how did you use these prebuilt libs?

cocos gen-libs is not support option --ap in version 3.13.1, itā€™s added recently.

Version 3.13.1 is based version 3.13, itā€™s not contains the changes for the option.

So, if you want to run cocos gen-libs command without android-10. Maybe you can try on of the two choices:

  1. Update the cocos2d-console submodule to the latest commit of github.
  2. Manual modify the target config in project.properties files:
    • tools/simulator/frameworks/runtime-src/proj.android/project.properties
    • cocos/platform/android/java/project.properties

Sorry for the inconvenience! Hope itā€™s helpful!

1 Like

@zhangxm i use gen-libs because i dont like to wait about 10 minutes when all project builds, so generated libs of cocos helps me to compile it one time and then just compile my project, so gen-libs is saves my time
and no i do not use Cocos Studio

1 Like

Got it, so you should modify the project yourself to use prebuilt libs.

@zhangxm yes i did it 10 month ago and it is works fine with different version of cocos, but question is ā€œwhy compilation is failedā€

About your error, i think all libs are generated, the error happens when generating binary codes. The error seems that you use wrong cocos console, did you update cocos console yourself?

@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: