Issue
I have a group of C/C++ libraries compiled with a standalone toolchain for API 19 and NDK rev 17, is it be possible to use these libraries on a project that uses API 26 (min SDK target 19)? Or do I need to recompile them using API 26?
In the script, make_standalone_toolchain.py
ask for the --api
argument but I am unsure if this is supposed to be the minimum API or the target API used on the project.
Solution
is it be possible to use these libraries on a project that uses API 26 (min SDK target 19)?
Yes, it is possible, but, may not be ideal. As seen from below android-ndk-r17c/platforms
structure:
android-ndk-r17c contains your project minimal API level 19, and this API level only includes TWO architectures, i.e. arm and x86. This means all your compilation will refer and link with those libraries inside arch-arm
or arch-x86
respectively. And note they are 32-bit ABIs. In future, if you have to include the 64-bit ABIs, e.g. x86_64
or arm64
, I think you need to recompile your native code at least with --api 21
(since api 21, NDK starts to support 64-bit ABIs).
If your android projects using your native shared libraries in question are compiled with minSdkVersion 21
or above 21, I would suggest you compile your native code using the standalone toolchains with --api 21
. Because there is no added value to set --api 19
.
References:
Answered By - shizhen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.