Saturday, February 15, 2014

Android studies update #1

Android Debug Bridge (ADB)

ADB is a command-line tool that you can install on Ubuntu with the following command in the terminal: sudo apt-get install android-tools-adb

This tool can be used to list devices, install .apk files, copy files to and from devices.

The command adb devices lists the attached android devices or running Android Virtual Machines. To see non-virtual devices, you have to turn on USB debugging in the Developer settings of the device. You might also have to run adb as root if you get the no permissions error when listing devices. In this case:
sudo killall -9 adb
sudo adb devices

After this you don't need sudo as the adb daemon is running as root.

You can open a terminal to connected devices using the adb shell command. You get a standard linux command line shell in which you can browse the file system and execute commands.


Some Eclipese hotkeys

ctrl+shift+l = Show hotkey list in which you can type to search what you need
ctrl+page up/down = Switch between opened files
ctrl+shift+f = Format source code


Creating the Hello World project

To jump start testing, you might want to create the usual Hello World program in eclipse by clicking File > New > Other > Android Application Project. Name the project Hello World and use the default options that are offered.

You can use the Run command to test the app. You might want to fire up your virtual device or connect the non-virtual one before.

If nothing seems to happen, you might be viewing the wrong file in the editor pane, try AndroidManifes.xml

Debugging

You can open the Dalvik Debug Monitor Server (DDMS) in Window > Open perspective DDMS


Complementary Cat Picture (CCP)