cocos2dx 3.17
android ndk r16b
This code will generate static libraries
cocos gen-libs -e /Applications/Cocos/Cocos2d-x/cocos2d-x-3.17 -p android --ap android-26
But, “prebuilt-mk” folder And “Android.mk” is not generated.
Why?
cocos2dx 3.17
android ndk r16b
This code will generate static libraries
cocos gen-libs -e /Applications/Cocos/Cocos2d-x/cocos2d-x-3.17 -p android --ap android-26
But, “prebuilt-mk” folder And “Android.mk” is not generated.
Why?
I copied “prebuilt-mk” folder manually from v3.16 to v3.17.
See here
Will it be officially responded?
I’d be nice, because it doesn’t work in my case
I worked on a static libraries build.
Make a new project with v3.17 and imitate build.gradle etc.
added it to build.gradle.
externalNativeBuild {
if (PROP_BUILD_TYPE == 'ndk-build') {
ndkBuild {
targets 'cocos2dcpp'
arguments 'NDK_TOOLCHAIN_VERSION=clang'
// ---- add ----
def module_paths = [project.file("${buildDir}/../../../cocos2d").absolutePath,
project.file("${buildDir}/../../../cocos2d/cocos/prebuilt-mk").absolutePath,
project.file("${buildDir}/../../../cocos2d/cocos").absolutePath,
project.file("${buildDir}/../../../cocos2d/external").absolutePath,
]
arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
// -------------
arguments '-j' + Runtime.runtime.availableProcessors()
}
}
do not know if it is useful
・Update Android Studio & Gradle 4.4.
・Delete *iml file.
・Fixed app/jni/android.mk , Application.mk, etc…
・Rename “proj.android-studio” to “proj.android”
I am very regret prebuilt-mk is removed at 3.17 release. refer to this
in this PR, the logic of generate prebuilt-mk was removed. and @zhangxm said
I update console just to keep compatibility, i don’t want developers to use prebuilt libs, and there is not template for it now.
So, official team didn’t maintain binary template from 3.17, also prebuilt-mk. we suggest developers to use source code directly.
@CrazyHappyGame hope you can known this, too. thanks.
That’s a very bad news. Why would we want to use source code directly? Project size is much bigger, compilation time is much longer.
There is PR when I try to use gen-libs
For now “cocos gen-libs” generate all libs. I think we need one Android.mk where all libs and include paths are added. Does some who knows Android.mk can help me write such Android.mk?
@CrazyHappyGame @shinichi @piotrros
Recently a Chinese developer find a solution to solve this issue, only need modify Android.mk, and not need to modify Gradle configs. those are the modified Android.mk files.
UseAndroidGenLibs.zip (22.1 KB)
UseAndroidGenLibs/prebuilt/android/Android.mk
into cocos2d-x/prebuilt/android
to use prebuilt libs after you generated Android libs.UseAndroidGenLibs/proj.android/app/jni/Android.mk
into proj.android/app/jni
to change the default behavior to use prebuilt/android/Android.mk
module for a new cpp project.you can refer to the comments in Android.mk
to know the details.
if you know some Chinese you can look into 关于cocos2d-x 3.17版本静态库的使用方法 - Cocos2d-x - Cocos中文社区
Thanks!
it worked.
Are there plans to be added officially in the future?
Not plan to added it into cocos2d-x inside. I think cocos2d-x forum have the ability to maintain this. Any developer good at Android Build can implement it, and share with us in the forum.
I’ve followed your instruction, cleaned everything, then builded new prebuilts and I’m still getting tons of these linker errors:
What am I missing?
My Android.mk file is now based on your solution.
I’ve finally did it! I’ve created a new empty project and copied stuff one by one. I still don’t know what caused these issues.
@drelaptop
what changes i need to make to use Cocos2d-x root path for libcocos2dx
instead of one inside the project.
I want to remove Cocos2d directory from my project and redirect my project to use cocos2d-x root directory for all files and references so that i can reduce the size of my projects as they all have cocos2d directory.
you should change the add module path of Android.mk in main project. please have a known of how Android.mk works