|
11 | 11 | * [How do I build and use the Android SDK?](#how-do-i-build-and-use-the-android-sdk) |
12 | 12 | * [Where can I find MQTT 311 Samples?](#where-can-i-find-mqtt-311-samples) |
13 | 13 | * [I still have more questions about this sdk?](#i-still-have-more-questions-about-this-sdk) |
| 14 | +* [How can I improve the library size? ](#how-can-i-improve-the-library-size) |
14 | 15 |
|
15 | 16 | ### Where should I start? |
16 | 17 |
|
@@ -123,37 +124,39 @@ Instructions for building, installing, and use of the Android SDK can be found [ |
123 | 124 | ### Where can I find MQTT 311 Samples? |
124 | 125 | The MQTT 311 Samples can be found in the v1.27.2 samples folder [here](https://github.com/aws/aws-iot-device-sdk-java-v2/tree/v1.27.2/samples) |
125 | 126 |
|
126 | | -### The library size is large, can I improve it? |
127 | | -The SDK depends on aws-crt-java(CRT) library, which deploys native binaries for multiple platforms and results in a huge size. You can try the following options to reduce the package size. |
128 | | -1. Use platform-specific dependencies |
129 | | -Instead of including all platform binaries, specify only the platforms you need. |
130 | | -Sample to use classifier from aws-crt: |
131 | | - ``` |
132 | | - <dependency> |
133 | | - <groupId>software.amazon.awssdk.crt</groupId> |
134 | | - <artifactId>aws-crt</artifactId> |
135 | | - <version>0.39.0</version> |
136 | | - <classifier>linux-x86_64</classifier> <!-- Only Linux 64-bit --> |
137 | | - </dependency> |
138 | | - ``` |
139 | | - Checkout aws-crt-java [available classifier](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#available-classifiers) |
140 | | - |
141 | | -2. Build CRT and SDK from source |
142 | | -You can also build the CRT library and SDK from source |
143 | | - |
144 | | - a. [Build aws-crt library from source](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#platform) |
145 | | - |
146 | | - b. Update SDK to use local CRT build. |
147 | | - Update the `sdk/pom.xml` dependencies: |
148 | | - |
149 | | - <dependency> |
150 | | - <groupId>software.amazon.awssdk.crt</groupId> |
151 | | - <artifactId>aws-crt</artifactId> |
152 | | - <version>1.0.0-SNAPSHOT</version> |
153 | | - </dependency> |
154 | | - |
155 | | - |
156 | | - c. [Build the SDK from source](https://github.com/aws/aws-iot-device-sdk-java-v2/blob/main/documents/DEVELOPING.md#building-from-source) |
| 127 | +### How can I improve the library size? |
| 128 | + |
| 129 | +The SDK depends on aws-crt-java, which includes native binaries for multiple platforms (~50MB total). Here are two approaches to reduce size: |
| 130 | + |
| 131 | +#### Option 1: Use Platform-Specific Dependencies |
| 132 | + |
| 133 | +Use classifiers to include only your target platform's binaries: |
| 134 | + |
| 135 | +```xml |
| 136 | +<dependency> |
| 137 | + <groupId>software.amazon.awssdk.crt</groupId> |
| 138 | + <artifactId>aws-crt</artifactId> |
| 139 | + <version>0.39.0</version> |
| 140 | + <classifier>linux-x86_64</classifier> <!-- Only Linux 64-bit --> |
| 141 | +</dependency> |
| 142 | +``` |
| 143 | + |
| 144 | +See [all available classifiers](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#available-classifiers). |
| 145 | + |
| 146 | +#### Option 2: Build from Source |
| 147 | + |
| 148 | +For maximum control, build both CRT and SDK locally: |
| 149 | + |
| 150 | +1. [Build aws-crt-java from source](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#platform) |
| 151 | +2. Update `sdk/pom.xml` to use local aws-crt build: |
| 152 | + ```xml |
| 153 | + <dependency> |
| 154 | + <groupId>software.amazon.awssdk.crt</groupId> |
| 155 | + <artifactId>aws-crt</artifactId> |
| 156 | + <version>1.0.0-SNAPSHOT</version> |
| 157 | + </dependency> |
| 158 | + ``` |
| 159 | +3. [Build the SDK from source](./DEVELOPING.md#building-from-source) |
157 | 160 |
|
158 | 161 |
|
159 | 162 | ### I still have more questions about this sdk? |
|
0 commit comments