Android Ndk and in Android programming is not in my primary competence, so I have to ask.
I have a cocos2d-x C++ based game which runs smoothly on Windows. Now I want to build it for Android. The problem is that I use external static libraries (*.lib in windows) files, which need to be linked in executable. I successfully built those libraries for android. Now I have shared *.so file and *.a files for different archs (see below). So far so good.
But after long researches, tries & errors, and still cannot understand how to link my cocos2d project against upper mentioned libs (static or shared).
Let me show you some screen shots.
This is my build of svgren lib as single shared library for different archs:
@netanalyzer In the screenshot you posted, there’s absolutely no trace of your libraries in Android.mk, so when building, the linker doesn’t even know that you want to link those 3rd party libraries.
There are plenty of examples on how to do this, even on this forum, such as here.
Other than that, I strongly recommend you stop using the Android.mk builds, and instead move to CMake builds, especially since going forward, CMake will be the only method used in Cocos2d-x (according to this).
I also learnt that order of included *.mk files is very important.
I have to refine/refactor my project, still I’m happy that after 2 days I finally have success.
PS: I know that CMake builds will be only method in future, but I choose ndk-build because cmake build failed for me even with a newly created project with cocos new .... I use Cocos2d-x 3.17.1. My build machine OS is Windows 10. I do not remember the exact errors with cmake build, but this is another topic.