https://github.com/ibitcy/eo-mobile-openssl-static
Get fresh version of openssl using prefab dependencies!
https://github.com/ibitcy/eo-mobile-openssl-static
android library native ndk openssl prefab static
Last synced: about 1 year ago
JSON representation
Get fresh version of openssl using prefab dependencies!
- Host: GitHub
- URL: https://github.com/ibitcy/eo-mobile-openssl-static
- Owner: ibitcy
- Created: 2021-12-09T16:34:01.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-08T23:30:57.000Z (over 2 years ago)
- Last Synced: 2025-03-27T18:50:16.433Z (about 1 year ago)
- Topics: android, library, native, ndk, openssl, prefab, static
- Language: C
- Homepage:
- Size: 12.8 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://jitpack.io/#ibitcy/eo-mobile-openssl-static)
## OpenSSL static library + prefab
Easy to use solution to bake fresh version of [OpenSLL](http://openssl.org/) into your NDK Library
## Before you start
This package made for using it with Gradle's "prefab" dependencies system.
So it's better to start with reading more about it [here](https://developer.android.com/studio/build/dependencies?buildsystem=cmake#native-dependencies-with-agp) or [here](https://github.com/android/ndk-samples/tree/main/prefab).
## Why we did it:
Using [Google's "Prefabbed" OpenSLL library ](https://mvnrepository.com/artifact/com.android.ndk.thirdparty/openssl) you'll face a problem with `libssl.so` and `libcrypto.so` on devices with Android 5
In this cases the one and only way to have latest version of OpenSSL in your app is merge it into your library
But you can have the best of both worlds: easy to implement prefab dependency + static .a libraries that will guarantee that your code will work on any version of Android as you expect
## How to
1. Add dependency to your build.gradle:
```gradle
repositories {
maven { url 'https://jitpack.io' }
}
..
dependencies {
..
implementation 'com.github.ibitcy:eo-mobile-openssl-static:1.1.1.12'
..
}
```
2. Add this code pieces to your CMakeLists.txt:
```cmake
find_package(openssl REQUIRED CONFIG)
..
get_target_property(OPENSSL_INCLUDE_DIR openssl::ssl INTERFACE_INCLUDE_DIRECTORIES)
..
set_target_properties(openssl::crypto PROPERTIES IMPORTED_LOCATION ${OPENSSL_INCLUDE_DIR}/../../../../jni/include/lib/${CMAKE_ANDROID_ARCH_ABI}/libcrypto.a)
set_target_properties(openssl::ssl PROPERTIES IMPORTED_LOCATION ${OPENSSL_INCLUDE_DIR}/../../../../jni/include/lib/${CMAKE_ANDROID_ARCH_ABI}/libssl.a)
..
target_link_libraries(
your_library_name
..
openssl::ssl
openssl::crypto
..
)
```
3. Build! 🎉🎉🎉
## Maintenance
We use this repo to build .a and .so
https://github.com/stephenkopylov/android_openssl_build_scripts/tree/main