How to shut down a Raspberry Pi running androidthings

Assuming the RPi3 running the androidthings image was connected to the internet at IP address, then to connect a laptop on the same network to the RPI3 running androidthings, and then shut down the androidthings RPI3, do the following: (note the -p means power off)

root@Inspiron-15R:~/Downloads# adb connect
connected to
root@Inspiron-15R:~/Downloads# adb shell reboot -p

Connecting my laptop to RPi3 androidthings and building my first androidthings device

Once I had flashed the image and booted up my RPi3 androidthings, I connected to the wifi and androidthings reported my connected IP address as:

From here in Step 2 – Connect the hardware, under #5:

I found this:

root@Inspiron-15R:~/Downloads# adb connect
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
connected to

So it seems I’m now wirelessly connected to the RPi3. So now I want to make an androidthings project on my laptop and deploy it on the RPi3 androidthings machine…  I’m now working on finding out how to do that.

So from this page:

I click on “build your first device”:

OK. That is a long drawn out document with many steps, so for now I will take a break.


How to shut down androidthings:

root@Inspiron-15R:~/Downloads# adb connect
connected to
root@Inspiron-15R:~/Downloads# adb shell reboot -p

Setting up the Raspberry Pi 3 Model B for Android Things

The below was done on my Dell Inspiron 15R laptop running Ubuntu Linux 17.10…  When completed, the image flashed  SD card was removed from the laptop and inserted into the Raspberry Pi 3. When the RPi3 was switched on, the Android Things logo appeared after a couple of minutes, and from the main screen I was able to connect to Wifi with no problem at all.

root@Inspiron-15R:~/Downloads# pwd
root@Inspiron-15R:~/Downloads# /home/anne/Downloads/android-things-setup-utility-linux

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
What hardware are you using?
1 - Raspberry Pi 3
2 - NXP Pico i.MX7D
3 - NXP Pico i.MX6UL
You chose Raspberry Pi 3.

Setting up required tools...
Fetching additional configuration...
Downloading platform tools...
5.44 MB/5.44 MB
Unzipping platform tools...
Finished setting up required tools.

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.
Downloading Android Things image...
314 MB/314 MB 
Unzipping image...

Downloading Etcher-cli, a tool to flash your SD card...
22.4 MB/22.4 MB
Unzipping Etcher-cli...

Plug the SD card into your computer. Press [Enter] when ready

Running Etcher-cli...
? Select drive /dev/mmcblk0 (15.7 GB) - 00000
? This will erase the selected drive. Are you sure? Yes
Flashing [========================] 100% eta 0s 
Validating [========================] 100% eta 0s 
iot_rpi3.img was successfully written to 00000 (/dev/mmcblk0)
Checksum: e5b2d28d

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.

Would you like to set up Wi-Fi on this device? (y/n) n
Error: canceled wifi setup
Stopping adb server...
Stopped adb server...

Now that you’re set up, try sample projects in Android Studio or in the sample
repository here:

To learn more about features like over-the-air updates, visit the Android Things

Press [Enter] to quit.


Starter code for new Empty Activity and LinearLayout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""

 android:text="Hello World!" />


import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

 protected void onCreate(Bundle savedInstanceState) {
} fix error

from the Udacity course on Android input:
there is a problem because some instructions are missing for the menu XML and action_settings string setting. 
The following page explains the fix:
and is documented here for future reference in case the link disappears:

Right click on the res folder while you’re in Android Studio, hover over new, then select Android Resource Directory. It will come up with a box which will probably have Directory name & Resource type both set to ‘values’. What you want to do is click on the down arrow to the right of the Resource type box, and select ‘menu’. The Directory name will also have changed to ‘menu’. Now click the OK button. Now you have your menu folder.

Next you need to create the menu_main.xml file. Right click on the menu folder, hover over new, then click on Menu resource file. It will open a box asking for the name of the file. Type in menu_main (you don’t need to put the .xml at the end, it will do that for you.

So now you need to copy and paste this code into your new file:

<menu xmlns:android=""
app:showAsAction="never" />

Then to fix the actions_settings string :

Go to res/values/strings.xml and add this second string:
    <string name="app_name">Court Counter</string>
    <string name="action_settings">Settings</string>
done! Everything works fine at this stage so the project was uploaded to GitHub.