Compile OpenSSL to different name due to Android Z

2019-02-27 21:54发布

问题:

I can build openssl-1.0.2j successfully for android (libcrypto.so and libssl.so) using GitHub stdchpie/android-openssl:

  • Environment: Linux OS, (my case I use Mac OS)

  • Android NDK: 12b

On Android 5.x if using:

System.loadLibrary("crypto");
System.loadLibrary("ssl");

It will get conflict with native OS libs which also have same names. And unluckily, manually change their names didn't work. So that I want to compile them into different names , like libcryptox.so and libsslx.so

I try to play with Makefile.org all day but not lucky. So please someone tell me how to do.

回答1:

The system has those libs loaded in the run-time environment, you can't use the System.loadLibrary

You can make small ndk code that will use native dload for those libs. And eventually, I think its best to use the ssl api's through the common android API as you never know what they will do next version.