@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:
- Update the cocos2d-console submodule to the latest commit of github.
- 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!
@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
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?
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
.
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
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. 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 ?
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
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: