2
votes

I tried to build 64bit (arm64) Openssl v1.1.1b and add it to my app as shared library (libcrypto.so and libssl.so). I built standalone toolchain with --arch arm64 and --api 21 arguments, then I built openssl libraries with it and added them to my app. All 64bit devices with Android 6.x and higher works great, but I am stuck on the Android 5.0.1 64bit – Lenovo TAB 2 A10-70L tablet.

The problem is, that on this specific Android, when I am loading libssl.so, I get error:

E/art     ( 2755): dlopen("/data/app/com.myapp.mypackage-1/lib/arm64/libssl.so", RTLD_LAZY) failed: 
dlopen failed: cannot locate symbol "EVP_camellia_128_cbc" referenced by "/data/app/com.myapp.mypackage-1/lib/arm64/libssl.so"...

E/MY_APP( 2755): 2019-06-12 14:22:27,984: [MY_APP][18446744071776944368] ERROR (2117) - Error in loading libraries : 
dlopen failed: cannot locate symbol "EVP_camellia_128_cbc" referenced by "/data/app/com.myapp.mypackage-1/lib/arm64/libssl.so"...

So exception will be thrown -> loading of other libraries after libssl.so will be not performed and app crashes during or after splashscreen.

I found on StackOverflow, that it can be caused, if you compile native library (as openssl) against higher android version, then the used tablet is… But I make openssl with api 21, that’s Android 5.0, so there shouldn’t be problem. It seems, that openssl expects this symbol in libraries of the device and this device doesn’t have it.

What I tried:

  1. To use different NDK’s to build openssl -> I used 15-19 NDK’s, with this version I built an app, but the same error occurred (with “cannot locate symbol”). I tried 12-14 NDK’s to be close to NDK we are using in our app for other native libs (which is 12b), but with this NDK I am not able to make openssl libs at all, it will fail during build.
  2. To use different NDK’s to build whole app -> I tried 16 and 19, but there were failures in the build and I don’t think, it would help.
  3. To use 21 as minsdkversion in AndroidManifests, project-properties and build.gradle files to have everything in the same api version, but with no success.
  4. I tried built and implement higher version of openssl – 1.1.1c – but the same error with Camellia occurred.
  5. I tried to add that missing symbol as a macro to evp.h, but with no success (maybe I should add it in the different way).
  6. I tried to exclude camellia cipher from build of openssl by editing makefile, but whole build ended with error

Why might this be happening, and how can I fix it to run my app on Android 5.x 64bit?

1
Did you make any progress on this one? I have the same issue on a Huawei P8 Lite (hwALE-H) - Android 5.0 - Marc Van Daele
Hi, I added answer:) - Lohi

1 Answers

2
votes

Self solution:) After all I tried as I mentioned above I found the only solution that worked - build openssl as static library (so libssl.a and libcrypto.a) and add this files to app.

It seems, that dynamic openssl libraries (*.so) does not work for my app, which uses older NDK, but to be honest, I still don't know why.