Android App Inventor on Fedora 13 #appinventor

Wouldn’t you know it, the App Inventor for Android “extras” software for Linux (evidently you have to wait for an exclusive invite to access the actual software which is apparently a Java applet) is only supplied as a .deb package. What’s a Fedora user to do? Aside from reflect on our own no-doubt-sordid history of such OS bigotry.

Well for one thing, you can complain. I used Twitter. If you find an email or form where someone might listen… let me know.

Also, there’s this program called alien that will try to convert your .deb to an RPM. But getting that to work is tricky itself. Alien is kind of old. None of the canned packages for it worked for me. Perhaps understandably it’s not packaged in the Fedora yum repo (probably because it’s not really considered a good idea to do this conversion; you should build the RPM from source. But you can’t do that when the source is not available. Hopefully this will be a temporary problem). So we’re back to the old make/make install business (alien has no tests, how comforting). Actually it’s a Perl project so there’s perl Makefile.PL first.

I needed a few extra packages for alien to work:

sudo yum install rpm-build perl-ExtUtils-MakeMaker

And then I could get the source for alien, and

tar zfx alien_8.81.tar.gz
cd alien
perl Makefile.PL
make install

If I were smart I’d probably package it into an RPM and install that, but I don’t have the time; I’m just happy to have it working.

Now it’s time to actually use alien for the conversion. This is using rpmbuild under the covers, and it wants to install files with root permissions, so I pretty much have to do everything with sudo.

$ sudo /usr/local/bin/alien --to-rpm appinventor-extras_1.0-1_all.deb
Package build failed. Here's the log of the command (cd appinventor-extras-1.0; rpmbuild --buildroot=/home/luke/Downloads/appinventor-extras-1.0 -bb --target noarch appinventor-extras-1.0-2.spec):
Building target platforms: noarch
Building for target noarch
Processing files: appinventor-extras-1.0-2.noarch
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/sh
error: Arch dependent binaries in noarch package

D’oh! alien is trying to create a noarch package, but it’s not actually architecture independent! Guess alien isn’t smart enough to figure that out or provide a reasonable default (like, the current system architecture). And guess what, there’s no option to override that. However, there IS an option to generate everything up to the rpmbuild command and then stop – it’s the –generate option:

sudo /usr/local/bin/alien --to-rpm appinventor-extras_1.0-1_all.deb \
                          -v --generate

And alien helpfully gave us the rpmbuild command line it tried, so we just need to modify the arch:

cd appinventor-extras-1.0/
sudo rpmbuild --buildroot=/home/luke/Downloads/appinventor-extras-1.0 \
              -bb --target i686 appinventor-extras-1.0-2.spec
cd ..
sudo yum install -nogpg appinventor-extras-1.0-2.i686.rpm

And there you have it. What a pain – and just to basically put some files in /usr/google/ (looks like mainly Android emulator images). And then wait for the invite.

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"
# 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.

test from a blog tool

i thought i’d try out some desktop blogging helpers so i don’t have to involve a browser for blogging. ubuntu has a few… going to see what lekhonee does for this blog (first complaint: it’d be nice if it told you your user/pass was bad before you tried to post). in addition to this blog i have an old personal one and a new one just about android that i’ll work on together with my brother – he’s hosting it.

speaking of which, he got back to me about setting the domain to what we wanted and enabling WP to write its own config so that’s fine; however the rewrite rules aren’t working. i’m used to setting up apache on fedora/RHEL so i’m not used to how things are done in ubuntu, but it didn’t take too long to figure things out (everything is called apache2 instead of httpd). curiously, there’s nothing in httpd.conf; i guess that’s fine, everything is modularized out into directories, which must make it a lot easier for tools to configure things without having to work around unrelated config items.

.htaccess isn’t being read because we have AllowOverride None in /etc/apache2/sites-enabled/ – needs to be All; and probably need to enable mod_rewrite with sudo a2enmod rewrite – so, waiting on him to do that. curses for not having my own root :-)

i worked on my android dev intro outline and i think i have it fairly complete and organized, enough to fill the time and more for the meetup this thursday :-) even as a n00b it’s not hard to have just a little more knowledge than those i’m giving the intro to.

The post is brought to you by lekhonee v0.7