Cocos2dx v3.17 prebuilt-mk is not generated

Cocos2dx v3.17 prebuilt-mk is not generated


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 “” is not generated.

[Solved] 3.17 release build error. "warning: relocation refers to discarded section"

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


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,
                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/ ,, etc…
・Rename “” to “”


@drelaptop can you read this and help?


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 where all libs and include paths are added. Does some who knows can help me write such


@CrazyHappyGame @shinichi @piotrros

Recently a Chinese developer find a solution to solve this issue, only need modify, and not need to modify Gradle configs. those are the modified files. (22.1 KB)


  1. copy UseAndroidGenLibs/prebuilt/android/ into cocos2d-x/prebuilt/android to use prebuilt libs after you generated Android libs.
  2. copy UseAndroidGenLibs/ into to change the default behavior to use prebuilt/android/ module for a new cpp project.

you can refer to the comments in to know the details.

if you know some Chinese you can look into

Update: We need help testing v3.17 (it's only a few weeks away)

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


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 in main project. please have a known of how works