hmm, let me try to build them now.
I used the 3.17 branch and android gen-libs worked for me.
gen-libs works for me too, but I can’t build the app with them. Something in the structure changed, because prebuilt-mk directories are missing.
Until now I successfully used them and it worked.
That’s their problem 50/50.
Same problem trouble me, why we only have a
gen-libs to gen prebuilt libraries, but didn’t have a option to use them. for example
--use-libs, we will easy to use them if existed that option.
So how to use the prebuilt libs? I think we have to create a Android.mk to add the prebuilt libs, and include engine header files. and then use it in Gradle, it’s same as using 3rd-party prebuilt libs, a common issue to use libs by Android.mk, not a special Cocos2d-x problem.
In other side, we support cmake for the android native build in coming 3.17 release, also GitHub v3 latest code, CMake build supply another way to generate libs, and use those libs, just enable/disable option, not need to do hard works. Refer to cmake/readme to know how to use it. the gradle configs is,
// prebuilt root must be defined as a directory which you have right to access or create if you use prebuilt // set "-DGEN_COCOS_PREBUILT=ON" and "-DUSE_COCOS_PREBUILT=OFF" to generate prebuilt, like "cocos gen-libs" // set "-DGEN_COCOS_PREBUILT=OFF" and "-DUSE_COCOS_PREBUILT=ON" to use prebuilt, like "--use-libs" // default behavior is both OFF, neither gen-libs nor use-libs. arguments "-DCOCOS_PREBUILT_ROOT=/Users/laptop/cocos-prebuilt" arguments "-DGEN_COCOS_PREBUILT=OFF", "-DUSE_COCOS_PREBUILT=ON"
and please set
PROP_BUILD_TYPE=cmake to enable cmake native build, refer to this in
# android native code build type # none, native code will never be compiled. # cmake, native code will be compiled by CMakeLists.txt # ndk-build, native code will be compiled by Android.mk PROP_BUILD_TYPE=ndk-build
My main experience that it’s always unstable and too much arguments need to set and checked and after some time\update - something will be broken, repeat. It’s complicated and takes time.
But using just “source code” option now all stable for me for a long time and so I will stay with this. Using prebuilts for ios mac only works same stable way.
you will have to rebuild pre-compiled libs if the source code of engine changes, I think not any better choice.
wonderful, using prebuilt isn’t necessary for using the engine.
Some notes about Windows versions (win32 and win10):
(would be great to have it include in a next update)
on Win10 & Win32:
- add Box2D libs from 3.15 in cocos2dx-3.17/external (for Win32 need to configure the lib for recent version of SDK and Visual studio, also setted as dll instead of static lib but not sure of what I do)
- add in project .vcxproj: code “4068” in DisableSpecificWarnings (debugs & releases nodes) (to avoid pragma mark warnings)
- get the proj.win10 back (for now I copy a directory from a cocos2dx-3.15 proj.win10 generated project)
- remove all libbullet references in the yourproject.sln and App/yourproject.vcxproj files (seems that some ref are also in libcocos on Win32)
add “$(EngineRoot);” in the 2 AdditionalIncludeDirectories (debug & release) (to get rid of some cocos-ext include issues)
change project properties-> c/c++ -> Debug Information Format C7 compatible(/Z7)
ie in vcxproj
for issues of kind “Internal Compiler Error: failed to write injected code block to PDB”
build-cfg.json is not supported, so could be deleted, in the .vcxproj file, use instead:
xcopy “$(ProjectDir)…\Resources\your_path_one” “$(OutDir)” /D /E /I /F /Y
xcopy “$(ProjectDir)…\Resources\your_path_two” “$(OutDir)” /D /E /I /F /Y
replace libcurl_impl.lib; by libcurl.lib; in release AdditionalDependencies in vcxproj
Any way to not use the prebuilt external and build it our self like in 3.16
You can use the source tree or run
cocos gen-libs or do I not understand your question?
@slackmoehrle Sorry, will try to explain more. I am using a highly modified box2d and now since 3.17 uses prebuilt box2d. How can I use mine? In 3.16 I will just replace box2d that’s in the external folder with mine and compile it. Now I can’t do that anymore.
Appreciate it if you can give some guidance.
Android or iOS?
Android. But does it matter? In 3.16 it works for both by replacing box2d in external folder.
I think it does matter on how it is solved. iOS is easier. Android I think will require modifying some files.
Another method, you can build your custom Box2d into prebuilt-libs and replace the default Box2d, if you select this way, you can refer to:
@drelaptop Thank you!
@slackmoehrle do you know what files needed to be change to compile custom box2d?
By the way thank you for the help!
I feel like you could add your library to one of the files like: Android.mk, Application.mk, etc.
Maybe another way if I bring in box2d as part of /Classes/box2d/ will it collide with the prebuilt box2d?