Saturday, June 16, 2012

ADB Over Wifi

When you are doing android development and you don't have the usb adapter with you, there's a way to use adb by tweaking your device using adb over wifi.  To do this, your device must be rooted. I'm using CyanogenMod and this tweak is part of the features.  First, enable the ADB Over Wifi then restart the device.

Once restarted go to your Terminal Emulator.
$ su
# setprop service.adb.tcp.port 5555
# stop adbd
# start adbd

On your computer, 
$ adb connect 192.168.1.48:8000

The ip address on the example is the ip address of your device. If you don't know how to get the ip address of your device, here's a quick step.  Go to Settings > Wireless & Networks > Wifi Settings > select the network that you're connected to.

And you should be connected!  Now you can proceed with android development without worrying your usb adapter.


More detailed info here.

Wednesday, June 13, 2012

Setting Android Environment Variable

When debugging android applications, I always use the terminal to check the logcat but using it I still have to go to tools directory under android sdk.  It's very inconvenient for me since I cannot use the android commands in other directories.  By default, setting up the android sdk into Eclipse for the first time, ANDROID_HOME environment variable isn't setup by linux file system.  To setup,

open the terminal and edit the .bashrc file and add these lines at the end of the file:
ANDROID_HOME=/home/path_to_/android-sdk-linux
export ANDROID_HOME

and then append this to the current PATH
PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH

The tools and platform-tools directory are the most important here since they contain all the android-related commands.

Sunday, June 10, 2012

Add Workspaces in Unity 2D

In Lucid Lynx, I am used to work with 6 workspaces and each workspace has its own function.  One workspace for Chrome, one for Eclipse, one for the Terminal (logcat), one for the Android Emulator, and the other one for Pidgin.  I am an LTS user and I wasn't bothered by other releases (Maverick Meerkat, Natty Narwhal, Oneiric Ocelot) until when Precise Pangolin was released, the desktop was changed from GNOME to Unity interface.  Now I upgraded my Lynx to the new LTS Pangolin on both my desktop and laptop.

I experienced different issues on desktop and on my laptop with the Unity interface.  The first look into Unity from desktop and laptop puzzled me.  On desktop, I can change the size of the launcher to 32 and add more workspaces in it.  Glad I found MyUnity, a tweaking tool for Unity desktop.  On laptop, I see no options to change the launcher size.  MyUnity only works on Unity 3D.  Now this made me think that my laptop has Unity 2D.  Then I did my research and found this tweak.

On terminal:
$ wget http://webupd8.googlecode.com/files/script.py
$ chmod +x script.py
$ sudo ./script.py 32

The '32' changes your icon launcher size to minimum.  Now to add more workspaces to your Unity desktop, I also found this tweak.

On terminal, you have change thru gconf and run this command:
$ gconftool-2 -s -t integer /apps/metacity/general/num_workspaces 6

Restart your machine.

Do you have any alternatives?  Glad if you share.  Just add it in the comments.