views:

1377

answers:

3

I am brand new to Eclipse and Android, but somewhat familiar with Java. That having been said, I tried to follow the 'Hello Android' tutorial from the developer site using the latest Eclipse (Galieo) and the 2.1 Android SDK, I am on a Macintosh running Snow Leopard (OS X 10.6). I have a default virtual device (though my target is actually for phones like my own HTC Incredible which has the snapdragon processor and of course all the latest accoutrement in smart phones.

Everything seemed to go okay until I went to RUN>RUN and then selected 'Android Application'. My computer spins it's wheels for a while and then I see two errors. I have pasted the output from Eclipse below:

[2010-05-04 01:53:46 - HelloAndroid] ------------------------------
[2010-05-04 01:53:46 - HelloAndroid] Android Launch!
[2010-05-04 01:53:46 - HelloAndroid] adb is running normally.
[2010-05-04 01:53:46 - HelloAndroid] Performing com.example.helloandroid.HelloAndroid activity launch
[2010-05-04 01:53:46 - HelloAndroid] Automatic Target Mode: launching new emulator with compatible AVD 'myAVD'
[2010-05-04 01:53:46 - HelloAndroid] Launching a new emulator with Virtual Device 'myAVD'
[2010-05-04 01:53:58 - HelloAndroid] New emulator found: emulator-5554
[2010-05-04 01:53:58 - HelloAndroid] Waiting for HOME ('android.process.acore') to be launched...
[2010-05-04 01:53:59 - Emulator] 2010-05-04 01:53:59.501 emulator[10398:903] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
[2010-05-04 01:54:23 - HelloAndroid] emulator-5554 disconnected! Cancelling 'com.example.helloandroid.HelloAndroid activity launch'!

I never do see the text in the emulator and the emulator crashes with a message about it quitting unexpectedly.

The crash report states:

Process:         emulator [10472]
Path:            /Applications/android-sdk-mac_86/tools/emulator
Identifier:      emulator
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  eclipse [10468]

Date/Time:       2010-05-04 02:25:41.153 -0500
OS Version:      Mac OS X 10.6.3 (10D573)
Report Version:  6

Interval Since Last Report:          2558914 sec
Crashes Since Last Report:           4
Per-App Crashes Since Last Report:   2
Anonymous UUID:                      C5F178C1-5290-4CA9-AD6E-E9C4F5582754

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000001fd2f000
Crashed Thread:  3

NOTE: Running the emulator from the command line with:

iainnitro-Mac:tools iainnitro$ ./emulator -avd myAVD

2010-05-04 02:49:23.011 emulator[10556:903] Warning once: This application, or a library it
uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw 
and move to Quartz.
Segmentation fault
iainnitro-Mac:tools iainnitro$

yields a segmentation fault(as noted above from the terminal output). So the emulator is dying on its own before anything can be shown.

I have tried restarting the ADB processes.

The actual code is line by line from the tutorial and I have never been able to get to the XML part yet.

I am not sure what is wrong with my environment setup or if it is just an incompatibility with Snow Leopard? I would REALLY appreciate any help in resolving this as I am very interested in developing on this platform.

Thank-you,

Mike N Lawrence, Kansas

+1  A: 

No direct experience, but this seems to be a recurrent issue:

This thread suggests:

You haven't let the emulator boot all the way up. Start it then wait until you see a desktop, just like on a real phone.

This one mentions (I suspect point 1. is not a concern for you):

  1. Get more RAM. I was running on 256 MB (which I believe is below minimum requirements), just upgraded today to 1024 MB (long time coming), application now starts fine. Although I still do see some error messages in the emulator, they don't seem to actually do anything.

  2. Install from command line. This is a bit laborius, but you can launch an emulator from the command line (assuming <android sdk path>\tools is added to your PATH variable) just type emulator, then browse to the location of your_app_here.apk, and execute

adb install your_app_here.apk

If you launch the emulator from Eclipse, execute adb kill-service and then adb start-service first (or kill-server / start-server. not sure the exact commands). Then your app will be installed on the emulator.


Also (a bit old but might still be relevant)

Maybe the emulator is running so slow, and the adb server, or another component like "DDMS" is a little "desperate" because seems it's waiting to the emulator to iniatialize the some HOME aplication.
But the emulator is running slow, the console in Eclipse send a message: emulator-5554 disconnected! Cancelling 'com.android.hello.HelloAndroid' launch!; and the emulator continues running normally and boot it's system, but don't run application that I build.

So for that problem I run program, and when the emulator is opened, I go back to eclipse in DDMS Perspective and in the Device tab y press a button "restart adb server" before the console shows me the message of "emulator-5554 disconnected!".
I do it several times until the emulator finally boot the OS.
After booted the OS on the emulator, eclipse don't send that disconnect error, and "sends" the app that I've built, also the console shows messages about this.
Then finally appears on the mobile "Hello, Android".

VonC
the emulator actually dies on it's own with the Android_ screen up right after the last entry. I will try the adb ideas and see if that helps, but more memory might be in order... though my machine does have 2 GB -- it is a month old Mac Mini :-)
Mike Needham
ran emulator from the command line and it dies with a segmentation fault.
Mike Needham
A: 

There has been a discussion on this with two proposed solutions http://code.google.com/p/android/issues/detail?id=724

Comment 17 by zachrcrowe, Jan 06, 2010 FYI - I had to change a line in the Hello Android example to read this.setContentView(tv); in order for it to work. As mentioned above, the deprecation warning shouldn't affect the functionality of the emulator.

Comment 18 by mfrony, Jan 14, 2010 I had the same problem when I ran the Hello Android example. The way I solved it and could run my first Android code was by changing the Project Build Target from 1.1 to 1.5.

Ravi Vyas
I am sure that my target (and mainly installed platformm which is Android 2.1) is okay. I am still getting 'emulator quit unexpectedly' when launching right as the last line comes up. Adding crash report info to original question. Trying this.setTextView suggestion.
Mike Needham
A: 

For whatever reason, I stopped getting the segmentation fault when I added: this.setContentView(tv);

the 'this' seemingly solved the issue. The seg fault happens if you try to run the emulator without any .apk file I assume. (I was getting that from the command line as well). I hope the tutorial will be updated.

Mike Needham