... or not.
Trying to get going on Android Development, and everything's going fine. But I'm not able to get to my coveted "Hello Android" due to this message:
"Connection Failure when starting to monitor device 'emulator-5554' : device (emulator-5554) request rejected: device offline"
So my emulator is offline. Hmm. It's a file in a directory, seems unlikely that it would be offline. Impossible really. Well the emulator did fire up once, so it can't be too broken. But my first impressions of Eclipse are quite good, it's a darn nice app for being free.
I thought this part of the tutorial was pretty funny (in reference to installing a driver file for the G1, on Windows this is the standard "Found New Device" wizard):
If you're developing on Mac OS X, it just works. Skip this step.
Vs.
If you're developing on Ubuntu Linux, you need to add a rules file:
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"
Now execute:
chmod a+rx /etc/udev/rules.d/50-android.rules
I guess that's the Mac
gestalt in action. Wonder what it's called on Linux? It's a sort of
gestalt that's for sure. Shudder. Would watching someone type that in would give me
schadenfreude? Look at all the big German words getting tossed around. Yes I had to look up the spelling. No I'm not putting in any umlauts.
Now compare the Android version of Hello World to the iPhone version:
Android:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
iPhone:
- (void) applicationDidFinishLaunching: (id) unused
{
UIWindow *window;
struct CGRect rect = [UIHardware fullScreenApplicationContentRect];
rect.origin.x = rect.origin.y = 0.0f;
window = [[UIWindow alloc] initWithContentRect: rect];
mainView = [[UIView alloc] initWithFrame: rect];
textView = [[UITextView alloc]
initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
[textView setEditable:YES];
[textView setTextSize:14];
[window orderFront: self];
[window makeKey: self];
[window _setHidden: NO];
[window setContentView: mainView];
[mainView addSubview:textView];
[textView setText:@"Hello World"];
}
Wow, just looking at the iPhone version makes my carpal tunnel flare up. Coming from a C# background, the Android version is a cakewalk. I'll reserve my "learn weird code" miles for F#.
Hello Android will have to wait, not sure what the deal is with that emulator. Google search was no help there.