is it too much to ask…

Would it be too much to ask that when I use the ADT resource generator tools, they produce XML that looks not like this:

… but instead actually readable like this:

I mean, I suppose if I just wrote it directly in the first place (Eclipse does offer good completion help), I wouldn’t care. But it’s nice to use the graphical tools just for getting started sometimes, and then it sucks to reposition the text so I can make sense of it.

Am I the only person complaining?

UPDATE: Score! This is exactly what I need. Wow, looks like this guy has a ton of other useful information too. Blogrolled!

Hmm, minor little problem – I added a key shortcut for “Clean up” but it’s not firing. I guess I can remember Alt-S, C, Return.

wireless doom, skin success, android device bridge

last night i put my laptop in suspend; this morning after un-suspend, wireless didn’t work for fedora. i installed a lot of updates to the OS last night so i guess one of them broke wireless. fabulous. submitting a bug. at least wired network is fine.

total success on the android g1 skins melding. basically, i created two subdirectories, one each for portrait/landscape images. then i merged the two layout files; as everything was pretty explicit in the layout files, my “parts” section consists of three parts: one shared “device” part (which is the display screen), and one part each for landscape and portrait (which just wrapped the rest of the previously separate layout files). i had to specify that the “device” part was rotated and translated for landscape – in portrait, x/y specify the upper left corner of the screen; in landscape where this is rotated, x/y refer to the lower left corner of the screen. also because for landscape the system automatically rotates the dpad effects, i had to re-rotate it to undo that (since everything is explicit and correct in the button layout) as commented in the HVGA layout. now all i need to do is send a copy to the original author and ask him to place it in the creative commons so i can rebrand it :-)

So, I thought for a quick bit of fun I’d try attaching to my phone from my computer (like you can to an emulator). Windows makes you install some USB driver and then reboot – well, the heck with rebooting. Under Ubuntu, you need to do some obscure udev voodoo to connect, but that’s OK. This is all it takes for Karmic Koala (thanks to this post):

$ sudo su -
# cat > /etc/udev/rules.d/51-android.rules
SUBSYTEM=="usb", SYSFS(idVendor)=="0bb4", SYMLINK+="android_adb", MODE="0666"
^D
# chmod a+r !$
# service udev restart

Then I connected my device and it was visible to adb right away. I got a shell on the phone. It’s not a root shell like in an emulator, so there doesn’t seem to be a lot you can do! For instance, the /data directory isn’t readable, so no scoping out databases. You can run top, dmesg, etc. from the /system/bin directory. Maybe I’ll find uses for that. I was hoping maybe there’d be some kind of bridge to open a telnet connection to the console on the device (like on emulator) but I guess that’s not available. If I think about it, makes sense, you don’t want someone’s computer to be able to do much to your phone if you just happen to connect its USB cable.

Connected eclipse to it – only one process is visible, the uploader. But I set my app to debuggable and kicked it over to the phone, and debugging worked great. That’s pretty sweet! Definitely necessary if you’re really using the device interactively. And something that would be useful even if you weren’t planning to do any development: you can do a screen capture of your device from DDMS in Eclipse!

I was thinking that part of the reason people use Java so much is the awesome remote debugging abilities. But then it occurred to me to ask whether other languages do this too. Certainly they do – no particular reason why it shouldn’t be possible. Looks like gdb can do it for the languages it supports, and there are at least some ways to do it for Perl and Ruby, though I’m not clear on whether anybody actually does that – though knowing Ruby someone has an awesome way to debug into Rails apps as they run.

Importing git checkout project into eclipse workspace

Note: for some reason this post still gets a lot of hits. My post much later might be more helpful.

Trying to figure out how best to import Android projects into eclipse, particularly from a version control checkout. I’ve had the same trouble with trying to use samples downloaded from book/tutorial sites. What I’m trying to do:

  • I want to locate the project in my eclipse workspace.
  • I don’t want eclipse-specific files in version control – those seem to cause problems when moving between different eclipse installations. Or, in the case of downloaded examples, these files aren’t provided.
  • Use git; other VCSs have Eclipse plugins to simplify this – git does too, but it seemed half-baked and I shouldn’t have to use a plugin to do this.

Problems:

  • If I check out the project outside my workspace, and then try to create a project in eclipse using that as source, eclipse does not move or copy it into the workspace; it uses the original location (which makes sense)
  • If I check out the project within my workspace, and then try to create a project using it as source, eclipse refuses because of the location.
  • If I use File -> Import -> General -> Existing projects into workspace, eclipse expects to see its project descriptors (that I deliberately excluded with .gitignore) and refuses the import.
  • No other options seem appropriate to doing this

Here’s one way to do it:

  1. Check out the project somewhere.
  2. Use the “create project” dialog to create an Android project using this location as source. This adds the requisite eclipse project descriptor files.
  3. Close the project and delete it (leaving the files in place of course).
  4. Move the project directory into the eclipse workspace.
  5. Use File -> Import -> General -> Existing projects to import the project directory – since the project files are there now, this works fine.

I wonder if I’m just nutty leaving the eclipse project files out of the checked-in version. But they just don’t seem to belong there, neh?