Created
March 5, 2021 10:54
-
-
Save rhulha/3a2bce7dc3d43c4bab8a14a31feecc38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling an Android project that depends on OpenSSL using Prefabs | |
Prefabs are a new feature of the Android Gradle Plugin 4.0. | |
Here is an outdated but still informative blog post about the subject: | |
https://android-developers.googleblog.com/2020/02/native-dependencies-in-android-studio-40.html | |
In the app build.gradle you simply add: | |
dependencies { | |
implementation 'com.android.ndk.thirdparty:openssl:1.1.1g-alpha-1' | |
} | |
Here is a list of available packages: | |
https://maven.google.com/web/index.html?q=com.android.ndk.thirdparty#com.android.ndk.thirdparty:openssl | |
Currently available packages are: curl, jsoncpp and openssl. | |
In the android section in the app build.gradle you also add: | |
buildFeatures { | |
prefab true | |
} | |
And in the defaultConfig section in the android section in the app build.gradle you also add: | |
externalNativeBuild { | |
cmake { | |
arguments "-DANDROID_STL=c++_shared" | |
} | |
} | |
Otherwise you get this error message: | |
> User is using a static STL but library requires a shared STL | |
In the CMakeList.txt you add: | |
find_package(openssl REQUIRED CONFIG) | |
And to target_link_libraries you add: | |
openssl::crypto | |
openssl::ssl | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mrousavy did you ever figure this out? I encountered the same issue