Hello World stopped unexpectedly?

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Hello World stopped unexpectedly?

Postby Tangela » Thu May 19, 2011 1:21 am

When I run my program in the android emulator it tells me "Sorry! The application Hello World(process com.example.HelloWorld) has stopped unexpectedly. Please try again." then it tells me to force close. I have no idea what is causing this. When I run my emulator I have to run it twice or else it will just say "ANDROID_" and not go to the menu screen. I am not sure if that could be a problem or could it be something else. Also I am getting no errors from eclipse.

Here is my code:

Engine.java:
Code: Select all
package com.example.HelloWorld;

import android.content.Context;
import android.view.View;
import android.graphics.Canvas;
import android.graphics.drawable.*;
import android.graphics.drawable.shapes.OvalShape;

public class Engine extends View {
    private ShapeDrawable mDrawable;

   
   public Engine(Context context) {
        super(context);

        int x = 10;
        int y = 10;
        int width = 300;
        int height = 50;

        mDrawable = new ShapeDrawable(new OvalShape());
        mDrawable.getPaint().setColor(0xff74AC23);
        mDrawable.setBounds(x, y, x + width, y + height);
    }

    protected void onDraw(Canvas canvas) {
        mDrawable.draw(canvas);
    }

}


Also here is my eclipse console (Not sure to put this in to the code tags so I will do it anyway)
Code: Select all
[2011-05-18 19:52:56 - Hello World] ------------------------------
[2011-05-18 19:52:56 - Hello World] Android Launch!
[2011-05-18 19:52:56 - Hello World] adb is running normally.
[2011-05-18 19:52:56 - Hello World] Performing com.example.HelloWorld.Engine activity launch
[2011-05-18 19:52:56 - Hello World] Automatic Target Mode: Preferred AVD 'Android' is not available. Launching new emulator.
[2011-05-18 19:52:56 - Hello World] Launching a new emulator with Virtual Device 'Android'
[2011-05-18 19:52:57 - Hello World] New emulator found: emulator-5554
[2011-05-18 19:52:57 - Hello World] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-18 19:53:12 - Hello World] ------------------------------
[2011-05-18 19:53:12 - Hello World] Android Launch!
[2011-05-18 19:53:12 - Hello World] adb is running normally.
[2011-05-18 19:53:12 - Hello World] Performing com.example.HelloWorld.Engine activity launch
[2011-05-18 19:53:12 - Hello World] Automatic Target Mode: Preferred AVD 'Android' is not available. Launching new emulator.
[2011-05-18 19:53:12 - Hello World] Launching a new emulator with Virtual Device 'Android'
[2011-05-18 19:53:12 - Emulator] emulator: ERROR: the user data image is used by another emulator. aborting
[2011-05-18 19:53:16 - Hello World] HOME is up on device 'emulator-5554'
[2011-05-18 19:53:16 - Hello World] Uploading Hello World.apk onto device 'emulator-5554'
[2011-05-18 19:53:16 - Hello World] Installing Hello World.apk...
[2011-05-18 19:53:54 - Hello World] Success!
[2011-05-18 19:53:55 - Hello World] Starting activity com.example.HelloWorld.Engine on device emulator-5554
[2011-05-18 19:54:34 - Hello World] New emulator found: emulator-5554
[2011-05-18 19:54:34 - Hello World] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-18 19:54:40 - Hello World] emulator-5554 disconnected! Cancelling 'com.example.HelloWorld.Engine activity launch'!
[2011-05-18 19:57:48 - Hello World] ------------------------------
[2011-05-18 19:57:48 - Hello World] Android Launch!
[2011-05-18 19:57:48 - Hello World] adb is running normally.
[2011-05-18 19:57:48 - Hello World] Performing com.example.HelloWorld.Engine activity launch
[2011-05-18 19:57:48 - Hello World] Automatic Target Mode: Preferred AVD 'Android' is not available. Launching new emulator.
[2011-05-18 19:57:48 - Hello World] Launching a new emulator with Virtual Device 'Android'
[2011-05-18 19:57:48 - Hello World] New emulator found: emulator-5554
[2011-05-18 19:57:48 - Hello World] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-18 19:57:57 - Hello World] ------------------------------
[2011-05-18 19:57:57 - Hello World] Android Launch!
[2011-05-18 19:57:57 - Hello World] adb is running normally.
[2011-05-18 19:57:57 - Hello World] Performing com.example.HelloWorld.Engine activity launch
[2011-05-18 19:57:57 - Hello World] Automatic Target Mode: Preferred AVD 'Android' is not available. Launching new emulator.
[2011-05-18 19:57:57 - Hello World] Launching a new emulator with Virtual Device 'Android'
[2011-05-18 19:57:57 - Emulator] emulator: ERROR: the user data image is used by another emulator. aborting
[2011-05-18 19:58:07 - Hello World] HOME is up on device 'emulator-5554'
[2011-05-18 19:58:07 - Hello World] Uploading Hello World.apk onto device 'emulator-5554'
[2011-05-18 19:58:09 - Hello World] Installing Hello World.apk...
[2011-05-18 19:58:35 - Hello World] Success!
[2011-05-18 19:58:35 - Hello World] Starting activity com.example.HelloWorld.Engine on device emulator-5554
[2011-05-18 19:58:39 - Hello World] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.HelloWorld/.Engine }
[2011-05-18 19:59:57 - Hello World] New emulator found: emulator-5554
[2011-05-18 19:59:57 - Hello World] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-18 20:00:21 - Hello World] HOME is up on device 'emulator-5554'
[2011-05-18 20:00:21 - Hello World] Uploading Hello World.apk onto device 'emulator-5554'
[2011-05-18 20:00:23 - Hello World] Installing Hello World.apk...
[2011-05-18 20:00:46 - Hello World] Success!
[2011-05-18 20:00:46 - Hello World] Starting activity com.example.HelloWorld.Engine on device emulator-5554
[2011-05-18 20:00:50 - Hello World] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.HelloWorld/.Engine }
[2011-05-18 20:08:07 - Hello World] ------------------------------
[2011-05-18 20:08:07 - Hello World] Android Launch!
[2011-05-18 20:08:07 - Hello World] adb is running normally.
[2011-05-18 20:08:07 - Hello World] Performing com.example.HelloWorld.Engine activity launch
[2011-05-18 20:08:07 - Hello World] Automatic Target Mode: Preferred AVD 'Android' is not available. Launching new emulator.
[2011-05-18 20:08:07 - Hello World] Launching a new emulator with Virtual Device 'Android'
[2011-05-18 20:08:07 - Hello World] New emulator found: emulator-5554
[2011-05-18 20:08:07 - Hello World] Waiting for HOME ('android.process.acore') to be launched...
[2011-05-18 20:08:14 - Hello World] ------------------------------
[2011-05-18 20:08:14 - Hello World] Android Launch!
[2011-05-18 20:08:14 - Hello World] adb is running normally.
[2011-05-18 20:08:14 - Hello World] Performing com.example.HelloWorld.Engine activity launch
[2011-05-18 20:08:14 - Hello World] Automatic Target Mode: Preferred AVD 'Android' is not available. Launching new emulator.
[2011-05-18 20:08:14 - Hello World] Launching a new emulator with Virtual Device 'Android'
[2011-05-18 20:08:14 - Emulator] emulator: ERROR: the user data image is used by another emulator. aborting
[2011-05-18 20:08:31 - Hello World] HOME is up on device 'emulator-5554'
[2011-05-18 20:08:31 - Hello World] Uploading Hello World.apk onto device 'emulator-5554'
[2011-05-18 20:08:32 - Hello World] Installing Hello World.apk...
[2011-05-18 20:08:54 - Hello World] Success!
[2011-05-18 20:08:54 - Hello World] Starting activity com.example.HelloWorld.Engine on device emulator-5554
[2011-05-18 20:08:58 - Hello World] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.HelloWorld/.Engine }
Tangela
Once Poster
Once Poster
 
Posts: 1
Joined: Wed May 18, 2011 3:08 am

Top

Re: Hello World stopped unexpectedly?

Postby raj_J2ME » Fri May 20, 2011 10:05 am

Hi and welcome to the Android Forums... :)

I will recommend you to test the hello world demo as the IDE generates for you. Don't change the code and let it runs as it is. This is how you can check that which code segment is gonna create the issues for you,

Then keep on adding the code to the classes. You should also check the logcat to see the exactly reason for the exception. To open this go to the Windows Tab -> Open perspective and the select the logcat.
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 4 guests