Cocos2dx v3.17 prebuilt-mk is not generated

Cocos2dx v3.17 prebuilt-mk is not generated
0.0 0

#1

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?


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

I copied “prebuilt-mk” folder manually from v3.16 to v3.17.

See here

Will it be officially responded?


#3

I’d be nice, because it doesn’t work in my case :frowning:


#4

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”


#5

@drelaptop can you read this and help?


#6

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.


#7

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.


#8

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?


#9

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

steps

  1. copy UseAndroidGenLibs/prebuilt/android/Android.mk into cocos2d-x/prebuilt/android to use prebuilt libs after you generated Android libs.
  2. copy 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 http://forum.cocos.com/t/cocos2d-x-3-17/60897


#10

Thanks!
it worked.

Are there plans to be added officially in the future?


#11

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.


#12

I’ve followed your instruction, cleaned everything, then builded new prebuilts and I’m still getting tons of these linker errors:

https://pastebin.com/PWj2UQiv

What am I missing?

My Android.mk file is now based on your solution.


#13

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.


#14

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


#15

you should change the add module path of Android.mk in main project. please have a known of how Android.mk works