Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4605190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:23:55+00:00 2026-05-22T00:23:55+00:00

I am trying to run my first hello world application on the 2.3.1 emulator

  • 0

I am trying to run my first hello world application on the 2.3.1 emulator but I get the following error message: “The application Hello World (process com.helloworld) has stopped unexpectedly. Please try again.

What could be the reason this is happening?

Here is the source code:

 package com.helloworld;

 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;

 public class HelloWorldActivity extends Activity implements View.OnClickListener {

     Button button;
     int touchCount;

     @Override 
     public void onCreate(Bundle savedInstanceState){
         super.onCreate(savedInstanceState);
         button = new Button(this); //create the Button
         button.setText( "Touch me" ); //set its initial text
         button.setOnClickListener(this); 
         setContentView(button);    
          }

     public void onClick(View v) {
         touchCount++; //Increase the touchCount
         button.setText("Touched me " + touchCount + "time(s)");
     }  
    }

Stack Trace:

05-10 17:32:18.749: ERROR/AndroidRuntime(511): FATAL EXCEPTION: main
05-10 17:32:18.749: ERROR/AndroidRuntime(511): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.helloworld/com.helloworld.HelloWorld.activity}: java.lang.ClassNotFoundException: com.helloworld.HelloWorld.activity in loader dalvik.system.PathClassLoader[/data/app/com.helloworld-1.apk]
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.os.Looper.loop(Looper.java:123)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.ActivityThread.main(ActivityThread.java:3647)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at java.lang.reflect.Method.invokeNative(Native Method)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at java.lang.reflect.Method.invoke(Method.java:507)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at dalvik.system.NativeStart.main(Native Method)
05-10 17:32:18.749: ERROR/AndroidRuntime(511): Caused by: java.lang.ClassNotFoundException: com.helloworld.HelloWorld.activity in loader dalvik.system.PathClassLoader[/data/app/com.helloworld-1.apk]
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1536)
05-10 17:32:18.749: ERROR/AndroidRuntime(511):     ... 11 more

http://pastebin.com/7R9pF34w

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:23:55+00:00Added an answer on May 22, 2026 at 12:23 am

    As noted in the comment above, the problem was this line in the manifest:

    <activity android:name=".HelloWorld.activity"
                      android:label="@string/app_name">
    

    The android:name attribute tells the VM what class to look for when launching the activity, but your class was created as public class HelloWorldActivity in your .java file. Thus, when the VM tried to instantiate a HelloWorld.activity object, it was unable to do so, and crashed with a ClassNotFoundException. The solution is to change the above to read:

    <activity android:name=".HelloWorldActivity"
                      android:label="@string/app_name">
    

    …so that it matches your class definition, therefore allowing the VM to find it. Further, the reason this caused a crash immediately at start up is because the first activity entry is considered the “start up” activity.

    You can find additional documentation pertaining to the manifest file here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm trying to run my first hello world prog written in C. I
I am trying to run HelloWorld android application, but the application doesn't load in
I'm trying to get my first Sinatra app off the ground, but am getting
I'm trying to compile my first linux ARM hello world program and when I
I'm trying to run the first server tutorial on RESTlet docs but i'm getting
Possible Duplicate: Can't run a ruby hello world application in Aptana I've just installed
I am trying to run a simple program hello world in my android mobile.
I am trying to run a spawn-fcgi script for php but I get the
It's getting frustrating. I've been trying to get a simple hello world type program
First steps in FreeBSD: trying to run my installation script. Fast help needed: #

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.