Emulator not running hello world - android

I setup the hello world project as per the tutorial ... and it did (at least once) display on the emulator (but not the first time, that I recall). I can't duplicate this. The log says:
[2011-10-04 17:11:38 - Hello World] ------------------------------
[2011-10-04 17:11:38 - Hello World] Android Launch!
[2011-10-04 17:11:38 - Hello World] adb is running normally.
[2011-10-04 17:11:38 - Hello World] Performing ca.daveg.helloworld.HelloWorld activity launch
[2011-10-04 17:11:38 - Hello World] Automatic Target Mode: Preferred AVD 'testA' is not available. Launching new emulator.
[2011-10-04 17:11:38 - Hello World] Launching a new emulator with Virtual Device 'testA'
[2011-10-04 17:11:42 - Emulator] emulator: warning: opening audio input failed
[2011-10-04 17:11:42 - Emulator]
... which is odd. I don't know what audio has to do with anything ... and I do have a headset connected to the computer (with both mic and headphones attached).
The emulator just boots (and works fine) without displaying my app. I've tried 2.2, 2.3 and 3.1.something. I've tried different heap sizes. I've searched this site extensively, but none of the standard hints (running app.exe various ways, etc) have helped.
Even saying the emulator is slow --- I've waited for it, but my system is a 4.2Ghz i7 with 6 Gig of RAM and fast disks... so nothing can be terribly slow on it.
FYI, here's the code as I have it right now...:
package ca.somedomain.helloworld;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorld extends Activity {
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android 2");
setContentView(tv);
}
}

this problem has been explored numerous times with numerous resolutions.. it's not your code.
Try killing the adb by just issuing the command adb kill-server and then adb start-server on your command prompt.
some kill people kill the abd.exe process.. then do an uninstall of their application if that exists. If you search for this error.. you'll find plenty of example resolutions here on stackoverflow.

Ironically, the answer was provided not by anything I can find on the forums, but by the upgrade notes of the next version of the SDK:
The problem was a space in the filename of the package.

Related

cannot start Android emulator on Eclipse even though there are no errors

I'm trying to run one of the Android sample apps in Eclipse. I've been through all the possible errors, and now I was finally able to run without any of them. But still, nothing works, and the emulator just has the "android" sign shining on it.
The log I have is:
[2011-12-26 21:18:50 - AccelerometerPlayActivity] ------------------------------
[2011-12-26 21:18:50 - AccelerometerPlayActivity] Android Launch!
[2011-12-26 21:18:50 - AccelerometerPlayActivity] adb is running normally.
[2011-12-26 21:18:50 - AccelerometerPlayActivity] Performing com.example.android.accelerometerplay.AccelerometerPlayActivity activity launch
[2011-12-26 21:19:26 - AccelerometerPlayActivity] Uploading AccelerometerPlayActivity.apk onto device 'emulator-5554'
[2011-12-26 21:19:26 - AccelerometerPlayActivity] Installing AccelerometerPlayActivity.apk...
[2011-12-26 21:19:28 - AccelerometerPlayActivity] Success!
[2011-12-26 21:19:28 - AccelerometerPlayActivity] Starting activity com.example.android.accelerometerplay.AccelerometerPlayActivity on device emulator-5554
I already changed the configuration of the AVD, created a new one, etc. Nothing seems of any help
Does anyone have any idea?
Thanks
I would try to 'downgrade' the emulator.
I'm assuming you aren't programming for the newest android 4.0+ or something like that,
(Samsung galexy s is 2.0 or 2.2, I think).
When I had that problem it helped me alot.
try it :)
I had similar problem a long time ago. Make sure that path to your android sdk (or adb) doesn't contain any national symbols (cyrillic in my case) except English.
If you using Windows, also check your profile name.
Wait a little more.... in some computers, the emulator wait up to 10 minutes to run first time. Its a lot of time, but, next compile time, donĀ“t close it, just clear proyect, build all and run, and it will work.

Cannot able to run my application?

I'm following the book "Professional Android 2 Application Development" by Reto Meier. I created the "HelloWorld" project. I use Eclipse as an IDE. If I run the application then the simulator starts but my application cannot run. he following information is displayed in the console:
[2011-07-03 16:03:28 - Hello_world] ------------------------------
[2011-07-03 16:03:28 - Hello_world] Android Launch!
[2011-07-03 16:03:28 - Hello_world] adb is running normally.
[2011-07-03 16:03:28 - Hello_world] Performing com.paad.HelloWorld.Hello_worldActivity activity launch
[2011-07-03 16:03:28 - Hello_world] Automatic Target Mode: Preferred AVD 'device2_1' is not available. Launching new emulator.
[2011-07-03 16:03:28 - Hello_world] Launching a new emulator with Virtual Device 'device2_1'
[2011-07-03 16:03:56 - Hello_world] New emulator found: emulator-5554
[2011-07-03 16:03:56 - Hello_world] Waiting for HOME ('android.process.acore') to be launched...
[2011-07-03 16:05:12 - Hello_world] emulator-5554 disconnected! Cancelling 'com.paad.HelloWorld.Hello_worldActivity activity launch'!
I cannot understand why my application is not able to run.
Did you wait until the emulator finished starting?
The log you posted may indicate that you closed the emulator before it started up.
The start takes a while, depending on the device configuration you have chosen (up to 5 minutes for me, if I try to launch a tablet emulator).
While starting, it goes to a small text saying "android" to an android text-logo and after that its usually up
And did you unlock them emulator? The emulator behaves like a real phone,
there is the usual key-lock in place. You have to release that first,
depending on the android version your are using you either have to drag a handle sideways
or press the menu key (e.g. in Android 1.6). If the phone is locked, you cant launch your app. There should be some info text on the screen telling you what to do.
After you got that, try to run your app again. It should start.
Please note that you can leave the emulator open once you started it.
If you run your application, the newest version will always be uploaded into the
emulator and executed. No need to restart the emulator all the time (which takes ages).
Android has some very good official documentation and tutorials. I suggest you try starting with the "official" Hello World example. I started there with my first Android app, and it worked as advertised for me.
You could post your code so we can see possible problems.
You can also look at warnings and errors with LogCat (Window > Open Perspective > Other... > DDMS or something). Then use Log.d or Log.e in your code so you can trace how far it gets before messing up.

Eclipse Failed to start Android app in Emulator

I get the following output on Eclipse Console (Started with UAC on Win 7):
(Nothing on LogCAT)
[2011-07-01 18:13:42 - Test_Android_2_2] ------------------------------
[2011-07-01 18:13:42 - Test_Android_2_2] Android Launch!
[2011-07-01 18:13:42 - Test_Android_2_2] adb is running normally.
[2011-07-01 18:13:42 - Test_Android_2_2] Performing nx.Android.Test_Android_2_2Activity activity launch
[2011-07-01 18:13:44 - Test_Android_2_2] Launching a new emulator with Virtual Device 'Test_AVD'
But still there is no trace of my application on the emulator. It just shows the regular menu items & API Demos & other stuff.
Am I missing something?
P.S.
-adb kill-server & adb start-server did not help.
-Launching SDK, adb & Emulator before Eclipse does not help. While launching the app Eclipse doesn't see the any Currently Running Emulators so I'm forced to start a new one.
Thanks,
Nisheeth Barthwal
Strange as it may be. I went to LogCat console and noticed it had nothing. While people all over the net said to look for LogCat log.
That led me to thinking that maybe Eclipse wasn't able to talk to the adb.
Oddly enough my already running emulators wouldn't show up while Run/Debug-ing a new Project/Activity.
A somewhat of a adhoc approach, here's how I fixed it.
I opened the Devices View, which shows up the currently running emulators, mine wasn't there.
So I clicked on the little down-arrow & clicked on "Restart ADB" (or something like that). And presto! as the adb rebooted the Devices View listed my emulator (along with other stuff I didn't quite understand). Viewing the LogCat console showed the entire trace. And I could launch my app into the currently running emulator.
I had tried to restart adb numerous times through the console but it didn't made a difference. From Eclipse, it however did.
P.S. ADB still pesters by not listing the emulator & the same approach fixes it everytime. (Restart via Devices View)
it sounds like you haven't yet added the program.
Right click on your android project
select run as
select android application.

Android emulator fails to start

I searched google this morning and could not find an answer, so I would like folks on stackoverflow to help.
Until yesterday, everything was perfect, when I ran my android app from eclipse the emulator used to load, and I could test everything.
I used it today and the emulator does not load.
Here is the dump from the console
[2010-12-02 10:39:42 - HomeScreen] ------------------------------
[2010-12-02 10:39:42 - HomeScreen] Android Launch!
[2010-12-02 10:39:42 - HomeScreen] adb is running normally.
[2010-12-02 10:39:42 - HomeScreen] Performing com.Dyforms.XMLGui activity launch
[2010-12-02 10:39:42 - HomeScreen] Automatic Target Mode: launching new emulator with compatible AVD 'newAVD'
[2010-12-02 10:39:42 - HomeScreen] Launching a new emulator with Virtual Device 'newAVD'
I can see emulator.exe available in the task manager, but I do not see it launched.
Can you guys guide me what could be wrong?
Rupin
A restart of the machine did the trick..It works fine now
Check out RunConfiguration for project. inside it "Deployment Target Mode " is Automatic/Manual , Please if there is emulator you tried yesterday exists or not. - thanks
Try running the emulator standalone from the command line, in particular try doing it with the option to wipe the userdata partition in case things got messed up. It will boot a bit slower the first time after that as it has to re-dex-opt everything, but hopefully it should boot. Also, as soon as it seems like it's trying to run, adb shell into it and do a ps to see what it's up to.
There are also command line options to start the emulator with kernel log output, etc.
Or you could try creating a clean new avd.
Quit skype if it is running. It must use the same port as skype. When I quit it worked fine.
I struggled with the same problem. The CPU ran near 100% and the emulator never completed loading. It was only when I removed all the Apple products (iTunes, iCloud etc) from my PC that resolved the issue resolved. My PC became a lot more responsive too!

Issue with 'Hello Android' tutorial

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 its 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
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):
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.
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".
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.
This seems to be a timing issue. For some reason Eclipse attempts to load the application on to the emulator before it is "ready". I'm not sure why this occurs but I did find a work around: just start the emulator from the command line before you run the application.
Start clean by closing Eclipse (maybe the OP didn't exit Eclipse before he tried to run via the command line?)
Start the emulator via Terminal by navigating to the android-sdk-mac_86/tools directory and typing:
./emulator -avd my_avd
Open Eclipse and attempt to run the tutorial again using the same steps as before
A dialog box should open asking whether you would like to start a new AVD or use the one that is already running--choose to use the one that is already running.
what i did was to move the circle that appears when the AVD launches to the unlock position, and there it was 'Hello, Android'!
I had this same problem when I tried to run the emulator using a 4.0 AVD. It used to crash at the bootup screen and show 'Segmentation fault' in the console. I was able to fix it by increasing the SD card size of the AVD to 1GB from 32MB.
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.
See Related post
Another related post
This worked on Linux for me:
Run Emulator (Wait for the home screen of the Emulator to load)
Click Window > Open Perspective > DDMS
In Devices Panel, click on drop down menu > Reset adb
Run project

Categories

Resources