How to copy numbered/versioned .so file during apk

2019-08-11 07:51发布

问题:

I am using Android NDK to compile a library for Android. I successfully built the library and obtained the .so file. Wrote JNI wrappers and able to create an apk without any compilation errors.

My library depends on some other .so files. I manage to include them within the apk using the method described here. But the problem is, my library also depends on a numbered/versioned .so file, i.e. libxxx.so.9 and this file is not copied during apk installation. In other words, in my apk file, under lib/x86_64 folder, I have all .so files including the numbered one, libxxx.so.9, but after install, when I check app data from device shell, all .so files copied except the numbered one.

I read that I can put it under assets folder and move it under the correct location at first launch of the app, but is there a better way to place this file correctly without such a workaroud?