To proceed with the installation of Android Things, we just have to execute the script for our operating system:
$ sudo ./android-things-setup-utility-macos
If you are flashing a Raspberry Pi, you will need to run the script with sudo.
The script is quite self-explanatory. We just have to follow the steps and select what we want to do. The trickiest part is to configure Wi-Fi, but we can do that later any time in several ways. It looks like this:
Android Things Setup Utility (version 1.0.19)
============================
This tool will help you install Android Things on your board and set up Wi-Fi.
What do you want to do?
1 - Install Android Things and optionally set up Wi-Fi
2 - Set up Wi-Fi on an existing Android Things device
We select Install Android Things. We will be asked about the hardware since there are differences in the process. For this example we will be using a Raspberry Pi because it is a bit more complex. The setup for the iMX7D is simpler, since you do not need to extract the SD card or connect to the network via a cable.
What hardware are you using?
1 - Raspberry Pi 3
2 - NXP Pico i.MX7D
The script will download the required tools and will ask us if we want to use a default image or a custom one.
To get started on Android Things, a default image is the best option.
For our purposes, and for development in general, a default image is the best option. The custom image is used when you are later in the process of building your device and want to test that everything works as expected:
Raspberry Pi 3
Do you want to use the default image or a custom image?
1 - Default image: Used for development purposes. No access to the Android
Things Console features such as metrics, crash reports, and OTA updates.
2 - Custom image: Upload your custom image for full device development and
management with all Android Things Console features.
The script will then download the required image and flash it into the device.
If you are using an NXP board, this is done via the USB type C cable. Please note that the script is a bit confusing in terms of whether you have to connect to your laptop directly or via a USB hub. In any case, make sure the port can properly power the device. This is likely to fail if you use a non-powered USB hub.
When setting up an iMX7D, make sure the USB port can power the device properly.
Connect your device to this computer:
The USB cable should plug into your board's USB-C port. If your computer also has USB-C ports like the more recent MacBooks, you will need to use a USB hub.
Otherwise the board won't power on correctly.
In the case of a Raspberry Pi, you need to extract the SD card and insert it in your computer so that it can be flashed. This is the step that requires root permissions.
Downloading Etcher-cli, a tool to flash your SD card...
20.5 MB/20.5 MB
Unzipping Etcher-cli...
Plug the SD card into your computer. Press [Enter] when ready
[...]
iot_rpi3.img was successfully written to Apple SDXC Reader Media (/dev/disk3)
Checksum: 4d176685
And with that, our board has Android Things installed. Now, we have the option to configure Wi-Fi, which we are going to do in the next section.
If you have successfully installed Android Things on your SD card, you can now put the SD card into the Raspberry Pi and power it up. Otherwise you can abort and run the tool again.
This last message is a bit confusing. It asks us whether we have successfully installed Android Things. It refers to the need for root permissions to write on the SD card. If you forgot to run the script with sudo, it will fail and you'll need to start over again.