Prebuilt generation not working in 3.13.1 and 3.11.1

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

git checkout cocos2d-x-3.13.1
git submodule update --init
git submodule update
./download-deps.py

cocos gen-templates

cocos gen-libs -m release -p ios
cocos gen-libs -m release -p android --ap android-10

I used the android tool to ensure I have the SDK installed.

So I should use git, and not to download from official site - http://www.cocos2d-x.org/download ?
Why you tested from git if we talked about zip that was downloaded as I previously said?

Also, minimum target API for me currently 16 and I’ve installed only it, but I’m thinking even using API 19.

But anyway if I run with this command( just now tested this):

cocos gen-libs -m release -p android --ap android-10

I’m still getting this error:
The directory ‘android-10’ can’t be found in ANDROID_SDK_ROOT/platforms, please use --ap to set needed API level.

Anyway, I’ve downloaded latest cocos2d-x from git and tested on it and got same error.

However, when I specify android-16 it worked. So now --ap command works.
But, if you download official zip of cocos2d-x - it will not work.

I’ll look at this more. Thanks for all the description.

I’ve replied the reason before.

As I mentioned before, the binary template is added for the Cocos Studio. It’s not worked well in the cocos2d-x environment.

Sure. But please re-read my question.

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.

Yep, if a user want to using the engine as pre-built libraries. He/She should follow the two steps:

  1. Has a template named [language]-template-binary.
  2. Using cocos new with option -t binary.

In cocos2d-x, there isn’t any template named with -binary now. So, maybe some users are using command cocos gen-templates to implement the first step.

But in fact, the templates generated by command cocos gen-templates are used for Cocos Studio environment (It was invoked when generating the installer of Cocos Studio). It works not well in cocos2d-x environment. That’s why I suggested remove the usage of cocos new -t binary in the User Guide Document.

So we don’t have a template to use pre-builts without Cocos Studio code in it?

I need prebuilt libs for iOS, currently it works perfectly and saved my time.

I pulled from the v3 branch compiled using

cocos gen-libs -p android --ap android-10
cocos gen-libs -p ios

Sure, about that I already answered before: