JKRhb / dtls2

A DTLS library for Dart based on OpenSSL.
MIT License
3 stars 0 forks source link

OpenSSlLoadException: Could not find libcrypto. in Android #99

Open eserdeiro opened 6 months ago

eserdeiro commented 6 months ago

Hi. I have a problem when I want to use the library on Android (API Level 33). DTLS version ^0.16.0 How can I solve that? Thank you

Captura de pantalla 2024-04-19 a la(s) 03 09 32

I have installed https://pub.dev/packages/libcrypto in my project ( Version ^0.2.2 )

JKRhb commented 6 months ago

Hi @eserdeiro! To get the library to work, you need to bundle OpenSSL with your app as shared libraries. One way to achieve this is via a Flutter Plugin that integrates the bundling into the build process.

There is one such project called flutter_openssl_crypto which you can use for that – however, it is only bundling one of the two parts of OpenSSL required for this library. To temporarily solve the issue, you can include a patched fork of the plugin into your app's dependencies, like so:

  flutter_openssl_crypto:
    git:
      url: https://gitlab.com/jkr_hb/flutter_openssl_crypto.git
      ref: add-ssl

Note that this plugin only really works for Android at the moment and only includes an older version of OpenSSL 1.1.1 which has reached “End of Life” status by now, so using it is not really advisable for production at the moment. However, it should hopefully be possible to create a new plugin based on OpenSSL 3.2 in the upcoming months. I will keep this issue open until then but will already update the documentation a bit in the meantime :)

eserdeiro commented 6 months ago

Thanks for your answer! I will be aware of new updates.