Android Things Ubuntu 18.04

20 October 2018

A couple of days ago I was connecting a Android Things (NXP i.MX7D) to my Ubuntu 18.04 computer, but each time I tried to run a sample app in Android Studio I got the following error:

insufficient permissions for device: user in plugdev group; are your udev rules wrong?

So after some Googling I found out that I didn’t have enough privileges to access the Android Things device, simply put it was in
the wrong group.

So first i needed to add the path of the Android SDK and tools to my bashrc, well in my case to ~/.zshrc since I use Oh My ZSH. So first let’s add this two lines to the file:

nano ~/.zshrc
export ANDROID_HOME="$HOME/Android/Sdk"
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"

So now we can use adb with no problem, In case you haven’t install Android Studio you need to install it first then add the path to bashrc or zshrc. Adb its not need to solve the problem but it’s very handy when you are developing a Android aplication.

Now we need to find the usb device so lets execute lsusb in the terminal

Bus 003 Device 008: ID 18d1:4ee7 Google Inc.

You will get something similar. In this case we are looking fo a Google manufactured device. Les check the permissions of this device.

ls -l /dev/bus/usb/003/008
crw-rw-r-- 1 root root 189, 263 oct 19 23:37 /dev/bus/usb/003/008

So yeah it’s in the group root wich its causing the problem. We will need to add a rule for the device so its assigned to a group I can access. So let’s create the rule

sudo gedit /etc/udev/rules.d/whatever-name-you-want.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0660", GROUP="plugdev", SYMLINK+="android%n"

The idVendor and idProduct came from lsusb ID

Now we need to reconnect the device and we are ready to make a deploy.