Skip to content

Commit be12343

Browse files
committed
Android: update README.md
1 parent 0481fd1 commit be12343

1 file changed

Lines changed: 83 additions & 66 deletions

File tree

android/README.md

Lines changed: 83 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,99 @@
1-
# wolfSSL / wolfSSL JNI Android Examples
1+
# wolfSSL JNI/JSSE and wolfCrypt JNI/JCE Android Examples
22

3-
This directory contains:
3+
This directory contains two Android Studio projects that demonstrate how
4+
wolfCrypt JNI/JCE and wolfSSL JNI/JSSE can be integrated into an
5+
Android Studio project using the Gradle build system to compile both
6+
shared libraries and the application.
47

5-
**wolfssljni-ndk-sample** - Example project that demonstrates how to integrate
6-
wolfSSL and wolfSSL JNI into an Android NDK application's Android.mk build
7-
file.
8+
[wolfcryptjni-ndk-gradle](./wolfcryptjni-ndk-gradle)
89

9-
**wolfssljni-ndk-gradle** - Example project that demonstrates how to integrate
10-
wolfSSL and wolfSSL JNI into an Android Studio NDK application using the
11-
Gradle build system to compile both shared libraries and the application.
10+
[wolfssljni-ndk-gradle](./wolfssljni-ndk-gradle)
11+
12+
This directory also contains one older example of how wolfSSL JNI/JSSE
13+
could be integrated into an older standalone NDK toolchain project's Android.mk
14+
build file. The above Android Studio projects are the recommended approach
15+
unless using an older standalone NDK toolchain setup.
16+
17+
[wolfssljni-ndk-sample](./wolfssljni-ndk-sample)
18+
19+
wolfSSL also maintains an Android Studio example project that is shipped
20+
as part of the wolfSSL JNI/JSSE bundle. This example project is set up to
21+
run the wolfSSL JNI/JSSE tests on an emulator as well, and is located here:
22+
23+
[wolfSSL JNI/JSSE IDE/Android Example](https://github.com/wolfSSL/wolfssljni/tree/master/IDE/Android)
24+
25+
## wolfSSL Android Studio NDK Gradle Examples
26+
27+
### Prerequisites for successful installation
28+
29+
In order to build the wolfSSL JNI/JSSE or wolfCrypt JNI/JCE Android Studio
30+
sample applications you need to Install **Android Studio**,
31+
along with **Android NDK** support.
32+
33+
### Compiling and Running wolfssljni-ndk-gradle or wolfcryptjni-ndk-gradle
34+
35+
After a development environment has been set up, follow these instructions
36+
to compile and install either the wolfSSL JNI/JSSE + wolfSSL bundle, or the
37+
wolfCrypt JNI/JCE + wolfSSL bundle on the Emulator:
38+
39+
1) Change directories into the android/wolfssljni-ndk-gradle directory
40+
41+
2) Checkout wolfssl and wolfssljni git submodules
42+
43+
3) Create stub options.h (since we're using the GitHub repo for wolfSSL)
44+
45+
4) Open "wolfssljni-ndk-gradle" project in Android Studio and build project
46+
47+
```
48+
$ cd android/wolfssljni-ndk-gradle
49+
$ git submodule init
50+
$ git submodule update
51+
$ cp ./wolfssl/wolfssl/options.h.in ./wolfssl/wolfssl/options.h
52+
```
53+
54+
wolfSSL stable releases, available from the wolfSSL download page, contain
55+
<wolfssl/options.h>, but the GitHub development branch for wolfSSL does not.
56+
This is why options.h.in needs to be copied to options.h above.
57+
58+
If you would like to update the git submodules for wolfssl and wolfssljni to
59+
the most current development HEAD, use the following submodule update command
60+
in place of the one above:
61+
62+
```
63+
$ git submodule update --remote
64+
```
65+
66+
Or, to use a specific tag or commit, use `git checkout`:
67+
68+
```
69+
$ cd android/wolfssljni-ndk-gradle/wolfssl
70+
$ git checkout vX.X.X-stable
71+
```
72+
73+
To install and run the application in an Android emulator, set one up
74+
in Android Studio, then click the Debug application button on the Android
75+
Studio toolbar. This will allow you to choose what Android virtual machine
76+
you would like to use.
77+
78+
Logcat output from the emulator can be viewed by opening a new terminal window
79+
while the emulator is running and issuing:
80+
81+
```
82+
$ adb logcat
83+
```
1284

1385
## wolfSSL NDK Standalone Toolchain Example
1486

1587
### Prerequisites for successful installation
1688

17-
Prerequisites
18-
In order to build the wolfSSL JNI sample application,
19-
you need to:
89+
In order to build the wolfSSL JNI sample application, you need to:
90+
2091
* Install the `Android SDK` [link](http://developer.android.com/sdk/index.html)
2192
* Install the `Android NDK` [link](https://developer.android.com/tools/sdk/ndk/index.html)
2293

2394
Note that these instructions do not use the Android Studio IDE and environment.
2495
This package has been developed and tested using the Android NDK and SDK
25-
command line tools.
96+
command line tools only.
2697

2798
After installing the Android SDK, run the `SDK Tools` app packaged with it and
2899
install Android 4.4:
@@ -126,60 +197,6 @@ After compilation:
126197
on the phone, as described above for the emulator - using
127198
"adb debug install".
128199

129-
## wolfSSL Android Studio NDK Gradle Example
130-
131-
### Prerequisites for successful installation
132-
133-
Prerequisites
134-
In order to build the wolfSSL JNI Android Studio sample application,
135-
you need to:
136-
* Install Android Studio, along with Android NDK support
137-
138-
### Compiling and Running the wolfssljni-ndk-gradle or wolfcryptjni-ndk-gradle
139-
140-
After the development environment has been set up, follow these instructions
141-
to compile and install either the wolfSSL JNI + wolfSSL bundle, or the
142-
wolfCrypt JNI + wolfSSL bundle on the Emulator:
143-
144-
1) Change directories into the android/wolfssljni-ndk-sample directory
145-
146-
2) Checkout wolfssl and wolfssljni git submodules
147-
148-
3) Create stub options.h (since we're using the GitHub repo for wolfSSL)
149-
150-
4) Open "wolfssljni-ndk-gradle" project in Android Studio and build project
151-
152-
```
153-
$ cd android/wolfssljni-ndk-gradle
154-
$ git submodule init
155-
$ git submodule update
156-
$ cp ./wolfssl/wolfssl/options.h.in ./wolfssl/wolfssl/options.h
157-
```
158-
159-
wolfSSL stable releases, available from the wolfSSL download page, contain
160-
<wolfssl/options.h>, but the GitHub development branch for wolfSSL does not.
161-
This is why options.h.in needs to be copied to options.h above.
162-
163-
If you would like to update the git submodules for wolfssl and wolfssljni to
164-
the most current development HEAD, use the following submodule update command
165-
in place of the one above:
166-
167-
```
168-
$ git submodule update --remote
169-
```
170-
171-
To install and run the application in an Android emulator, set one up
172-
in Android Studio, then click the Debug application button on the Android
173-
Studio toolbar. This will allow you to choose what Android virtual machine
174-
you would like to use.
175-
176-
Logcat output from the emulator can be viewed by opening a new terminal window
177-
while the emulator is running and issuing:
178-
179-
```
180-
$ adb logcat
181-
```
182-
183200
## Support
184201

185202
Please contact wolfSSL at support@wolfssl.com with any questions, bug fixes,

0 commit comments

Comments
 (0)