Installing APK files through ADB

I was having trouble getting adb to recognize my phone.  I found this post that helped.  Here is what I did.

First, I used this command to determine, which device was my phone:

lsusb | grep "High Tech Computer Corp"

The output looked like this:

Bus 002 Device 008: ID 0bb4:0c01 High Tech Computer Corp.

When I look at the device node, I can see that permissions might be an issue.  If you notice from the above statement, the Bus is 002 and the Device is 008 so those are the numbers I will use in looking at the device.  Here is the command:

ls -l /dev/bus/usb/002/008

Here is the output

crw-rw-r-- 1 root vboxusers 189, 135 2010-06-16 09:54 /dev/bus/usb/002/008

Next, the post did not say where to place the rules file to correct this.  I found another article with a little more information on udev rules.

So, I opened the file with this command:

sudo gedit /etc/udev/rules.d/70-android.rules

And, I placed this in the file:

BUS=="usb", SYSFS{idVendor}=="0bb4", GROUP="android", MODE="0660" /* HTC */

Next add the group with this command:

sudo groupadd android

Next add the user (my username is skp) to the group with this command:

sudo usermod -a -G android skp

Then, it was time to test.  I restarted the udev service with this command:

sudo restart udev

Here is the output of the service:

udev start/running, process 23528

Now, I don’t see the phone, but I had VMWare running, so that may have grabbed the device instead.  I don’t know what happened and I had to come back to this later.  Then, after a reboot, my security settings looked better:

crw-rw---- 1 root android 189, 133 2010-06-16 21:25 /dev/bus/usb/002/006

Still, it didn’t work.  The command:

./adb devices

gives this output:

* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
Then, I realized that there is security on the phone. (I felt kind of silly)  I had to turn on the USB debugging option.  In the settings, I enabled Settings > Application settings > Development > USB debugging.
Then, the adb output looks like this:
List of devices attached
HT849GZ65323	device

Now that I have access to the phone, I used this command:

./adb install ~/app/<my program file>.apk

The output looked like this (I had already installed the application from the SDCard, so it makes sense):

383 KB/s (28018 bytes in 0.071s)
	pkg: /data/local/tmp/nehemiahG1.apk
Failure [INSTALL_FAILED_ALREADY_EXISTS]

This command did the reinstall:

./adb install -r ~/app/nehemiahG1.apk

Here is the output

224 KB/s (28018 bytes in 0.121s)
	pkg: /data/local/tmp/nehemiahG1.apk
Success

Success!

Leave a Comment

Your email address will not be published. Required fields are marked *