November 15th, 2009 by Lincoln Baxter III

Android: It’s about time!

I don’t know why I waited so long. Maybe I just thought the G1 was ugly, maybe it’s my futile fight against the mob of conformity. I bought the Droid. Now my already over-active sense of entrepreneurship, restless production has new food. Goodbye night-time reading for a little while.

XKCD’s Randall Munroe, you understand me better than most…

A few tips for the Linux users:

If you are developing with an AVD (Android Virtual Device) and you happen to plug your phone in, when you click “Run as, or Debug as Android Application,” Eclipse is going to try to deploy the app to your phone. Two things may happen:
  1. Your application will be deployed to the phone. Just so you know in case it’s not what you want to do. Be careful.

  2. If you are trying to deploy to your phone, but haven’t yet set up USB permissions, you will get a NullPointerException: “Failed to deploy…” – This means your USB permissions are wrong. More on that…

Fixing the null-pointer:

An internal error occurred during: "Socialize". java.lang.NullPointerException
at com.android.ide.eclipse.adt.internal.launch.AndroidLaunchController.launch(Unknown Source)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.doLaunch(Unknown Source)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(Unknown Source)

Chances are you need set up USB permissions by taking the following steps:

Plug in your phone and run “lsusb”

lincoln@quadshark ~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 008: ID 22b8:41db Motorola PCS 
Bus 004 Device 003: ID 046d:c505 Logitech, Inc. Cordless Mouse+Keyboard Receiver
Bus 004 Device 002: ID 046d:c041 Logitech, Inc. G5 Laser Mouse
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
lincoln@quadshark ~ $

This line: “Bus 002 Device 008: ID 22b8:41db Motorola PCS” is what you are looking for. “22b8” is my “idProduct”, and “41db” is my idVendor. Your phone may be different, so keep that in mind when you are following the next steps.

As root, Edit or Create: /etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTRS{idProduct}=="22b8", ATTRS{idVendor}=="41db",
MODE="0666", OWNER="lb3"

As root, Run: chmod a+r /etc/udev/rules.d/51-android.rules

lb3@quadshark ~ $ ls -la /etc/udev/rules.d/51-android.rules
-rw-r--r-- 1 root root 95 2009-11-15 17:19 /etc/udev/rules.d/51-android.rules
If your permissions look like the file above, and your IDs are set up correctly, then you should now be able to properly deploy and debug applications on your actual Android Phone! Enjoy 🙂

But where to go from here?

So many ideas already out there, but an infinity of un-thought-of ideas remain. Where do I go from here? How many other people out in this world have the desire to create, but a severe case of writer’s block!? Help me, Randall…….


PERL!



Lincoln Baxter, III

About the author:

Lincoln Baxter, III is the Chief Editor of Red Hat Developers, and has worked extensively on JBoss open-source projects; most notably as creator & project lead of JBoss Forge, author of Errai UI, and Project Lead of JBoss Windup. This content represents his personal opinions, not those of his employer.

He is a founder of OCPsoft, the author of PrettyFaces and Rewrite, the leading URL-rewriting extensions for Servlet, Java EE, and Java web frameworks; he is also the author of PrettyTime, social-style date and timestamp formatting for Java. When he is not swimming, running, or playing competitive Magic: The Gathering, Lincoln is focused on promoting open-source software and making technology more accessible for everyone.

Posted in Technology

4 Comments

  1. Raphael says:

    PERL? yieks!

    Now that Android has a jit we can safely use groovy and scala.

  2. Jory says:

    Didn’t work. 🙁
    Ubuntu 9.10, Eclipse 3.5.1, Android 2.0.1.

  3. Lincoln says:

    Strange, that’s exactly what I use.

  4. Radek Skokan says:

    Jory, I had the same issue. If you’re sure you have the rules file correct, try *as root*:

    adb kill-server
    adb start-server

    and then adb devices should display you connected device.

Leave a Comment




Please note: In order to submit code or special characters, wrap it in

[code lang="xml"][/code]
(for your language) - or your tags will be eaten.

Please note: Comment moderation is enabled and may delay your comment from appearing. There is no need to resubmit your comment.