How to Install Apps using ADB - Android Community Forums
Register Members List Social Groups Calendar Search Today's Posts Mark Forums Read


Go Back   Android Community Forums > Android Discussions > General Dev Discussions, How to, Guides and FAQ


General Dev Discussions, How to, Guides and FAQ Discuss Android Development How to and Guides here. No commercial posts please!

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2008, 10:32 AM
Sidonuke Sidonuke is offline
Sidonuke is beginning to hack the G1
Smoke signaler
 
Join Date: Oct 2008
Posts: 5
Sidonuke is on a distinguished road
Default How to Install Apps using ADB

Developing on Device Hardware

If you have an Android device, you can develop and debug your Android applications just as usual. Launching your apps on a device works just the same as on the emulator, but there are a few things to do before you can start.
  1. Declare your application as "debuggable" in your Android Manifest. In Eclipse, you can do this from the Application tab when viewing the Manifest (on the right side, set Debuggable to true). Otherwise, in the AndroidManifest.xml file, add android:debuggable="true" to the <application> element.
  2. Turn on "USB Debugging" on your device. On the T-Mobile G1, go to the home screen, press MENU, select Applications > Development, then enable USB debugging.
  3. Setup your system to detect your device.
    • If you're developing on Windows (32-bit only), you need to install the USB driver for adb:
      1. Download the driver ZIP file (android_usb_windows.zip) and unzip it.
      2. Connect your Android device via USB. When the Found New Hardware Wizard appears, you'll be asked if you'd like Windows Update to search for software, select No, not this time and click Next.
      3. Select Install from a list or specified location and click Next.
      4. Select Search for the best driver in these locations. Browse and select the unzipped file.
      5. Click Finish. You're all set.
    • If you're developing on Mac OS X, it just works. Skip this step.
    • If you're developing on Ubuntu Linux, you need to add a rules file:
      1. Login as root and create this file: /etc/udev/rules.d/50-android.rules. For Gusty/Hardy, edit the file to read:
        SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
        For Dapper, edit the file to read:
        SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
      2. Now execute:
        chmod a+rx /etc/udev/rules.d/50-android.rules
You can verify that your device is connected by executing adb devices from your SDK tools/ directory. If connected, you'll see the device name listed as a "device."
If using Eclipse, select run or debug as usual. If you have an emulator running, then you will be presented with a Device Chooser dialog that lists the emulator(s) running and the connected device(s). Otherwise, the device will be used by default, instead of launching a new emulator.
If using the Android Debug Bridge (adb), you can issue commands with the -d flag to target your connected device.

Installing an Application after your connected

You can use adb to copy an application from your development computer and install it on an emulator/device instance. To do so, use the install command. With the command, you must specify the path to the .apk file that you want to install:
adb install <path_to_apk>For more information about how to create an .apk file that you can install on an emulator/device instance, see Android Asset Packaging Tool (aapt).
Note that, if you are using the Eclipse IDE and have the ADT plugin installed, you do not need to use adb (or aapt) directly to install your application on the emulator/device. Instead, the ADT plugin handles the packaging and installation of the application for you.


Source: Google =)
Reply With Quote
Ads
  #2  
Old 10-27-2008, 07:16 AM
KanedaSyndrome KanedaSyndrome is offline
KanedaSyndrome has no status.
Smoke signaler
 
Join Date: Sep 2008
Posts: 32
KanedaSyndrome is on a distinguished road
Default Re: How to Install Apps using ADB

Hey will this work with a N810 running a hack install of Android? Is it possible to get my programs to work on N810?
Reply With Quote
  #3  
Old 10-27-2008, 07:32 AM
shoobadoop shoobadoop is offline
shoobadoop has no status.
Smoke signaler
 
Join Date: Oct 2008
Posts: 26
shoobadoop is on a distinguished road
Default Re: How to Install Apps using ADB

Note the usb drivers does not include Windows 64-bit yet, however they said they are working on them (over at the Android Groups).
Reply With Quote
  #4  
Old 10-31-2008, 11:35 AM
KanedaSyndrome KanedaSyndrome is offline
KanedaSyndrome has no status.
Smoke signaler
 
Join Date: Sep 2008
Posts: 32
KanedaSyndrome is on a distinguished road
Default Re: How to Install Apps using ADB

I wonder if my N810 that runs android has the "enable debugging" feature and if I can get my .apk files to run on a N810 that runs the hacked Android?

Please if anyone knows if this is possible I would be most most appreciative.
Reply With Quote
  #5  
Old 05-19-2009, 01:49 AM
jisnut jisnut is offline
jisnut has no status.
Smoke signaler
 
Join Date: May 2009
Posts: 2
jisnut is on a distinguished road
Default Re: How to Install Apps using ADB

I hope someone out there can help me. I just bought my G1 yesterday and I'm very excited about developing on Android. I did the simple Hello World app in Eclipse and tested it in the emulator ...all good.

So then I followed the steps listed above exactly for Ubuntu adding udev rules as prescribed for the Gutsy/Hardy Ubuntu release (suspecting those are the most recent) even though I have the very latest Jaunty release of Ubuntu.

Anyway, so I connect my phone with the USB cable. The phone notices and links up. I can mount my SD card in it as a drive and access it from my desktop so that all works...

I'm all smiles until I issue the "adb devices" command and all I see is my emulator.

/usr/bin/eclipse/android/v1.5/tools$ adb devices
List of devices attached
emulator-5554 device

I've unplugged the phone and plugged it back in several times ...no new adb devices show up.

I've tried a few other suggestions I've found on other sites:
- I've restarted the udev daemon like so: sudo /etc/init.d/udev restart
- I've listed the connected usb devices with "lsusb" and my phone shows up as:
Bus 002 Device 009: ID 0bb4:0c02 High Tech Computer Corp.
- Reset adb from the Devices view inside Eclipse.
Then all I get in the console are these errors:
[2009-05-19 00:44:03 - DeviceMonitor]Adb connection Error:EOF
[2009-05-19 00:44:03 - DeviceMonitor]Connection attempts: 1

I see the directions you've listed above are the same official directions listed here: http://developer.android.com/guide/d...tml#setting-up

Please someone tell me the Jaunty version of Ubuntu is why I'm having problems I don't want to have to go back to an earlier version of Ubuntu. Surely someone knows how I'd add appropriate rules for a Jaunty version of Ubuntu? It appears the only difference between the Dapper rules and the Gutsy/Hardy rules is the name of the subsystem and as far as I can tell this 'usb' subsystem name hasn't changed in Jaunty.

Thanks,
Justin
Reply With Quote
  #6  
Old 05-19-2009, 12:33 PM
smasraum's Avatar
smasraum smasraum is offline
smasraum is hardly working
Established entity
 
Join Date: Nov 2008
Location: Houston (Friendswood), TX
Posts: 242
smasraum is on a distinguished road
Default Re: How to Install Apps using ADB

There are Vista 64bit drivers now. I've got them working at the house.
__________________
Steve
Bronze G1
Virtudude's Rogers/HTC Cupcake
Reply With Quote
  #7  
Old 05-19-2009, 12:52 PM
ickyfehmleh's Avatar
ickyfehmleh ickyfehmleh is offline
ickyfehmleh is not going to be done in time for ADC2
Phone junkie!
 
Join Date: Sep 2008
Location: The Boonies of Pinal County, Arizona
Posts: 1,205
ickyfehmleh is on a distinguished road
Default Re: How to Install Apps using ADB

If you're not using an ADP1, I think you need to set "USB Debugging" on the G1 (it's in the Settings).
__________________
I blame this man for most programming problems.
Reply With Quote
  #8  
Old 05-24-2009, 02:23 AM
wddglr's Avatar
wddglr wddglr is offline
wddglr is discovering the mysteries of the Blue LED Mode...
Smoke signaler
 
Join Date: Feb 2009
Location: Capistrano Park, Texas
Posts: 3
wddglr is on a distinguished road
Send a message via AIM to wddglr
Lightbulb Re: How to Install Apps using ADB

Quote:
Originally Posted by jisnut View Post
I hope someone out there can help me. I just bought my G1 yesterday and I'm very excited about developing on Android. I did the simple Hello World app in Eclipse and tested it in the emulator ...all good.

So then I followed the steps listed above exactly for Ubuntu adding udev rules as prescribed for the Gutsy/Hardy Ubuntu release (suspecting those are the most recent) even though I have the very latest Jaunty release of Ubuntu.

Anyway, so I connect my phone with the USB cable. The phone notices and links up. I can mount my SD card in it as a drive and access it from my desktop so that all works...

I'm all smiles until I issue the "adb devices" command and all I see is my emulator.

/usr/bin/eclipse/android/v1.5/tools$ adb devices
List of devices attached
emulator-5554 device

I've unplugged the phone and plugged it back in several times ...no new adb devices show up.

I've tried a few other suggestions I've found on other sites:
- I've restarted the udev daemon like so: sudo /etc/init.d/udev restart
- I've listed the connected usb devices with "lsusb" and my phone shows up as:
Bus 002 Device 009: ID 0bb4:0c02 High Tech Computer Corp.
- Reset adb from the Devices view inside Eclipse.
Then all I get in the console are these errors:
[2009-05-19 00:44:03 - DeviceMonitor]Adb connection Error:EOF
[2009-05-19 00:44:03 - DeviceMonitor]Connection attempts: 1

I see the directions you've listed above are the same official directions listed here: http://developer.android.com/guide/d...tml#setting-up

Please someone tell me the Jaunty version of Ubuntu is why I'm having problems I don't want to have to go back to an earlier version of Ubuntu. Surely someone knows how I'd add appropriate rules for a Jaunty version of Ubuntu? It appears the only difference between the Dapper rules and the Gutsy/Hardy rules is the name of the subsystem and as far as I can tell this 'usb' subsystem name hasn't changed in Jaunty.

Thanks,
Justin

I've got the fix for you brother

Though the website tells you this:
Quote:
1. Login as root and create this file: /etc/udev/rules.d/50-
android.rules.
For Gusty/Hardy, edit the file to read:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

For Dapper, edit the file to read:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
2. Now execute:
chmod a+rx /etc/udev/rules.d/50-android.rules
rename the file to "51-android.rules" by going into Nautilus with root:
Code:
gksu nautilus
and make sure there is no trace of a 50-android.rules by viewing hidden files using Ctrl+H

then reboot your machine

i hope this helps

EDIT: This info should be added to the main post.

Found in Google Groups thanks to JBQ
http://groups.google.com/group/andro...3488c601243686

Last edited by wddglr; 05-24-2009 at 02:27 AM.
Reply With Quote
  #9  
Old 05-24-2009, 07:05 PM
jisnut jisnut is offline
jisnut has no status.
Smoke signaler
 
Join Date: May 2009
Posts: 2
jisnut is on a distinguished road
Thumbs up Re: How to Install Apps using ADB

Wddglr, you're a lifesaver!


Thanks for the suggestions they worked great. I thought about fiddling with that rule level but figured I should research what exactly it does first to this udev system I am completely unfamiliar with in Linux. But since you seemed pretty sure of yourself I just tried it and yeah, that seemed to be the only problem.


I can now see my phone in the Eclipse devices view and after struggling with the minSdkVersion attribute in the application manifest I can set breakpoints and debug the silly HelloWorld app so far. Very very cool!


Just a note for others who chose not to shell out for the Google Dev phone and just go to a T-Mobile store to buy the G1. It seems it comes out of the box with version 1.0 (API level 1) ...so presumably were stuck with that version of the operating system until T-Mobile rolls out new versions or maybe we can take our locked phones into a store eventually to be re-flashed?? Not sure, anyway setting this in the application manifest file was apparently a prerequisite:


<uses-sdkandroid:minSdkVersion="1"/>


I get the following warning in Eclipse, but at least it lets me launch and debug apps on my phone:

Code:
Manifest min SDK version (1) is lower than project target API level (2)	AndroidManifest.xml
...because I'm using the latest 1.1/1.5 SDK available. I don't know what other problems this might present for me down the road if I try to use features only in SDK 1.1 for example?


This minSdkVersion value is also the last field you can specify in the New Android Project wizard, and it immediately defaults to “2” which of course wouldn't work with my phone. Maybe others had figured this out right away, but it was a stumbling block for me for a while.


Again, Thank you so much Wddglr! This tip for Jaunty users should definitely be added to Google's main Android dev pages if someone knows who to contact about that.


Justin
Reply With Quote
Reply

Bookmarks


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump

Ads

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to install Android SDK Mr Android General Dev Discussions, How to, Guides and FAQ 4 10-25-2009 05:45 AM
can i install android on nokie e71? wafy8a Porting Android 10 10-26-2008 08:40 PM
Install Android Ujjwol Android-powered Hardware discussions 11 10-23-2008 01:01 PM
Install apps onto memory card? trumani Android-powered Hardware discussions 12 10-03-2008 05:46 AM
Install Python chanchad_tejas General Dev Discussions, How to, Guides and FAQ 0 01-26-2008 08:30 AM


All times are GMT -5. The time now is 07:13 PM.


Powered by vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Copyright © 2008-2009 Android Community / R3 Media LLC, All Rights Reserved.