Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 39 additions & 3 deletions documents/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [How do I build and use the Android SDK?](#how-do-i-build-and-use-the-android-sdk)
* [Where can I find MQTT 311 Samples?](#where-can-i-find-mqtt-311-samples)
* [I still have more questions about this sdk?](#i-still-have-more-questions-about-this-sdk)
* [How can I improve the library size? ](#how-can-i-improve-the-library-size)

### Where should I start?

Expand All @@ -28,14 +29,14 @@ To enable logging in the samples, you will need to set the following system prop
```

* `aws.crt.debugnative`: Whether to debug native (C/C++) code. Can be either `true` or `false`.
* `aws.crt.log.destination`: Where the logs are outputted to. Can be `File`, `Stdout` or `Stderr`. Defaults to `Stderr`.
* `aws.crt.log.destination`: Where the logs are output to. Can be `File`, `Stdout`, or `Stderr`. Defaults to `Stderr`.
* `aws.crt.log.level`: The level of logging shown. Can be `Trace`, `Debug`, `Info`, `Warn`, `Error`, `Fatal`, or `None`. Defaults to `Warn`.
* `aws.crt.log.filename`: The path to save the log file. Only needed if `aws.crt.log.destination` is set to `File`.

For example, to run `BasicPubSub` with logging you could use the following:

```sh
mvn compile exec:java -pl samples/Mqtt/Mqtt5X509 -Daws.crt.debugnative=true -Daws.crt.log.level=Debug -Daws.crt.log.destionation=Stdout -Dexec.mainClass=pubsub.PubSub -Dexec.args='--endpoint <endpoint> --cert <path to cert> --key <path to key>'
mvn compile exec:java -pl samples/Mqtt/Mqtt5X509 -Daws.crt.debugnative=true -Daws.crt.log.level=Debug -Daws.crt.log.destination=Stdout -Dexec.mainClass=pubsub.PubSub -Dexec.args='--endpoint <endpoint> --cert <path to cert> --key <path to key>'
```

You can also enable [CloudWatch logging](https://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html) for IoT which will provide you with additional information that is not available on the client side sdk.
Expand All @@ -55,7 +56,7 @@ System.out.println(CRT.awsErrorString(errorCode));

### I keep getting AWS_ERROR_MQTT_UNEXPECTED_HANGUP

This could be many different things but it most likely is a policy issue. Start with using a super permissive IAM policy called AWSIOTFullAccess which looks like this:
This could be many different things, but it is most likely a policy issue. Start by using a super permissive IAM policy called AWSIOTFullAccess which looks like this:

``` json
{
Expand Down Expand Up @@ -123,6 +124,41 @@ Instructions for building, installing, and use of the Android SDK can be found [
### Where can I find MQTT 311 Samples?
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)

### How can I improve the library size?

The SDK depends on aws-crt-java, which includes native binaries for multiple platforms (~50MB total). Here are two approaches to reduce size:

#### Option 1: Use Platform-Specific Dependencies

Use classifiers to include only your target platform's binaries:

```xml
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
<version>0.39.0</version>
<classifier>linux-x86_64</classifier> <!-- Only Linux 64-bit -->
</dependency>
```

See [all available classifiers](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#available-classifiers).

#### Option 2: Build from Source

For maximum control, build both CRT and SDK locally:

1. [Build aws-crt-java from source](https://github.com/awslabs/aws-crt-java/tree/main?tab=readme-ov-file#platform)
2. Update `sdk/pom.xml` to use local aws-crt build:
```xml
<dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
```
3. [Build the SDK from source](./DEVELOPING.md#building-from-source)


### I still have more questions about this sdk?

* [Here](https://docs.aws.amazon.com/iot/latest/developerguide/what-is-aws-iot.html) are the AWS IoT Core docs for more details about IoT Core
Expand Down
Loading