Android tips

Just a few tricks for android that I have needed a few times :)

Installing android sdk and getting it to work

 

When ever installing android sdk on debian/ubuntu based systems, additional libraries must be added, as some parts of the 64bit package is actually using i386 calls. (adb for instance), All functions should work just adding the i386 architecture.aapt(which is a packing tool) does, however require azlib, which is dependend on the three last libraries.

sudo dpkg --add-architecture i386

sudo apt-get update

sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

If this is not added,  you will get a bunch of errors stating a lot of executables does not exist.

Finally installlibgl1-mesa-dev. This is an OpenGL library, and is needed to render some simulators (avd's) correctly.

sudo apt-get install libgl1-mesa-dev


In order to debug on the phone instead of the emulator, a Udev rule must be added, and the following text added in it

sudo /etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"

after this run the following commands in order to reload udev rules

sudo udevadm control --reload-rules

sudo service udev restart

The vendorid is different for different makes of phones, and can be seen here: USB Vendor IDs. Note that your vendorid may change if you install a ROM. Mine used to be 0bb4 (HTC), but changed to 18d1. Hence the two lines in the udev rules. You can always perform a lsusb to check vendorid.

After this reboot the computer. You should be able to use adb devices

to check if the device works.