Linkage on phonne starting APK using NDK build or android.mk build

hi,

I was used to use android.mk to build application using OpenCL.so library.
For that i nedded to copy libraries from the phonne and build my JNI cpp librarie.
Then My APK had those libraries inside.

Starting the APK on phonne i used a trick to load the library using system.loadLibrary.
But this was only running with SDK < 24. As OpenCL and GLES librarie nedded somme other shared libraries depending on the phonne.
A had to copy all libraries nedded to the APK, using android.mk.

When the AKP strated on the phonne they could find those librarie in APK folders and link with my JNI library to start the APK.

So using android.mk i nedded all depedent libraries to be in the APK and laod them using system.loadlibrary.
Because using android.mk i was not able to find the depedent libraries on the phonne system/lib.

Now that android.mk as been depreciated(that what i read). I use the NDK procees using CmakeLists.txt with the correct implementation in build.gradle(app).
Using the new processus i just need to copy the openCL.so and link my jni cpp file with it and then depedent libraries will be found on phonne.
But i need to exclude the OpenCL library to be copied on the AKP. If not, the linker on phonne,when starting AKP,will not search libraries on the phonne.

So the question is to be sure that i anderstoud the difference between the use of android.mk and CmakeLists.txt NDK.

So if i need to access depedencie libraries on the phonne i need to link my OpenCL.so with my JNI cpp.
And if there is no libraries on the APK. Linker will search libraries on the phonne. So it is much better to use NDK in this case. because dependecies libraries can be numerous. And it is the case on last phonne.

so, is using android.mk can still be usefull if wee need depedencie librarie that are not on the phonne.
Or i just have to add the needed library in the CmakeLists.txt and i will get no problem starting the APK on the phonne.

In fact i just want to fully anderstand the processus of finding dependent libraries that are on the phonne and dependant libraries that are not on the phonne.

And why do i need to exclude OpenCL to be copied in the AKP if not it does not look to the phonne depedencie.

There is something that i do not anderstand in the NDK and android.mk processus.

When to use NDK or android.mk, and may be,in some case, use both at the same time.
i could resume with " how linkage on the phone is done and how to make it and wath is the difference between NDK and android.mk"

PS:
I know how to build excecutable on other platform. I take all the needed librarie compile and link and it is fine. But usinf android libraries can be on the phonne and it is a different process.

Fiil free to change the title of the post if needed.

Regards.

hi,

let do it step by step. If i need to use one library on the phonne, library that can have depedencies. What should i use ? CmakeLists.txt or android.mk.