Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robertying/androidcurlexample
Minimal Android example for using `libopenssl` and `libcurl` with `NDK` and `JNI`
https://github.com/robertying/androidcurlexample
android curl jni libcurl libssl ndk openssl
Last synced: 7 days ago
JSON representation
Minimal Android example for using `libopenssl` and `libcurl` with `NDK` and `JNI`
- Host: GitHub
- URL: https://github.com/robertying/androidcurlexample
- Owner: robertying
- License: mit
- Archived: true
- Created: 2020-02-01T15:27:00.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-05T05:27:55.000Z (over 3 years ago)
- Last Synced: 2024-10-02T06:41:47.193Z (4 months ago)
- Topics: android, curl, jni, libcurl, libssl, ndk, openssl
- Language: Java
- Size: 54.6 MB
- Stars: 27
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Android Curl Example
Minimal Android example for using `libopenssl` and `libcurl` with `NDK` and `JNI`.
Pay special attention to the directory **`app/src/main/cpp`** where most of the work resides.
## Mechanism
- Use Android NDK to compile C functions together with cross-compiled `libcurl` and `libopenssl` libs.
- Use JNI to connect C functions to Java functions.
- Load NDK compiled shared lib in Android app.
- Call Java functions which call C functions eventually and can use all the stuff `curl` and `openssl` provide.## Compile openssl and curl for Android
See this repo: [openssl-curl-android](https://github.com/robertying/openssl-curl-android) for how to cross-compile those two libs.
For simplicity, I just copied the whole build directory from [openssl-curl-android](https://github.com/robertying/openssl-curl-android) to `app/src/main/cpp/libs`. You may find better ways to place pre-compiled libs or just build them on the fly.
## **Note**
I have removed actual built libs from Git. Remember to copy precompiled ones to `app/src/main/cpp/libs` to make the app build.