Showing posts with label Droid. Show all posts
Showing posts with label Droid. Show all posts

Saturday, November 7, 2009

[An]Droid First App Deployed

---10 minutes later---

Despite my earlier problems, I was able to actually create a Hello World application and deploy it to my Droid. The application itself was a 45 second quickie with virtually nothing done to a standard Eclipse Android project. Once the device was plugged in using the USB cord and was recognized by Eclipse (albeit with some of the buttons disabled), the deployment itself was trivial, as outlined here:


Yup, just:
  • Right-Click on the project.
  • Select Run-As
  • Select Android Application
The way this worked was that I am running the adb daemon as root, launched from a sudo'ed shell. This established a privileged connection to the Droid. When I switched to the DDMS Perspective in Eclipse (running under my own user id) , it warned me that the debug port was already bound, but the device view displayed the Droid device just fine.



If you have more than one device/emulator attached, or you have a device and an emulator attached, you will be prompted to pick a deployment target:


I picked my Droid to deploy to and a split second later, it popped up on the Droid's display:


As an aside, the icons on the top bar there (left to right) indicate:
  • A current USB connection to the device is active
  • The application is running under Debug mode
  • The device's Bluetooth radio is turned on
  • The Verizon 3G network radio is turned on
  • The device's Wifi radio is turned on
  • The battery is fully charged
As simple as this application is, I feel like I have a significant accomplishment under my belt now. Just another 300,000 lines of Java and XML and I should have a real application.

[An]Droid Device and USB Driver Configuration

As I mentioned in my last post, the Eclipse Android plugin Device panel shared my view of the state of its recognition of my Droid phone when I connected via the USB cord:

???????????? no permissions

When I got up this morning, feeling a little more patient and investigative, I found these two pages which resolved this problem:

Outline of Connecting Devices via USB
Tweaking the Rules File for USB Devices and Permissions

I am running Ubuntu 8.1 64 and I was able to get a recognized device by changing my rules file (/etc/udev/rules.d/51-android.rules) to:

SUBSYSTEM=="usb|usb_device", SYSFS{22b8}=="0bb4", MODE="0660", GROUP="plugdev" SUBSYSTEM=="usb|usb_device", ATTR{22b8}=="0bb4", ATTR{idProduct}=="0c02", SYMLINK+="android_adb" SUBSYSTEM=="usb|usb_device", ATTR{22b8}=="0bb4", ATTR{idProduct}=="0c01", SYMLINK+="android_fastboot"

However, when I run ddms or Eclipse as any user other than root, I am back to the same no permissions error. I assumed that the GROUP="plugdev" bit would fix this (my own user is part of that group) but no.

So, in summary, when I run as myself, this happens:

.../android-sdk-linux/tools$ ./adb devices List of devices attached ???????????? no permissions

But then I ps -ef | grep adb, kill the adb fork-server server process and then run the same with sudo:

.../android-sdk-linux/tools$ sudo ./adb devices * daemon not running. starting it now * * daemon started successfully * List of devices attached device

Small inconvenience for now, I suppose. Until I figure this out, it is actually more convenient to use the standalone ddms (Dalvik Debug Monitor) tool (a direct analog of the Eclipse plugin but outside of Eclipse) since I can run that as root but continue running Eclipse under my own user.

---Update 4 Minutes Later---

Although the device is recognized now, it still does not report all the details one would see when attached to an emulator, such as Threads, GC etc. I can view logs and system/process details, but with all the interesting buttons greyed out, I am obviously not fully connected yet.


One thing I can do, though, is capture screen shots.


Perhaps tomorrow morning.........