ActivityManager: Error: Activity class {..} does not exist.

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

ActivityManager: Error: Activity class {..} does not exist.

Postby sumet » Mon Nov 19, 2007 5:17 pm

I just test write code follow sample Datewidget1.java
this my code

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.simetex;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.widget.TextView;
  6. import android.app.DatePickerDialog;
  7. import android.widget.DatePicker;
  8. import android.widget.TimePicker;
  9. import android.app.TimePickerDialog;
  10. import android.widget.Button;
  11. import android.view.View;
  12.  
  13. import java.util.Calendar;
  14.  
  15. public class MyThirdAndroid extends Activity {
  16.         /** Called when the activity is first created. */
  17.         private TextView tvDisplay;
  18.  
  19.         private int mYears;
  20.         private int mMonths;
  21.         private int mDates;
  22.         private int mHours;
  23.         private int mMinute;
  24.  
  25.         @Override
  26.         public void onCreate(Bundle icicle) {
  27.                 super.onCreate(icicle);
  28.                 setContentView(R.layout.main);
  29.  
  30.                 tvDisplay = (TextView) findViewById(R.id.display);
  31.  
  32.                 Button pickTime = (Button) findViewById(R.id.pickTime);
  33.                 pickTime.setOnClickListener(new View.OnClickListener() {
  34.                         public void onClick(View v) {
  35.                                 new DatePickerDialog(MyThirdAndroid.this, mDateListener,
  36.                                                 mYears, mMonths, mDates, Calendar.SUNDAY).show();
  37.  
  38.                         }
  39.  
  40.                 });
  41.  
  42.                 Button pickDate = (Button) findViewById(R.id.pickDate);
  43.                 pickDate.setOnClickListener(new View.OnClickListener() {
  44.                         public void onClick(View v) {
  45.                                 new TimePickerDialog(MyThirdAndroid.this, mTimeListener,
  46.                                                 "setTime", mHours, mMinute, false).show();
  47.  
  48.                         }
  49.  
  50.                 });
  51.  
  52.                 final Calendar c = Calendar.getInstance();
  53.                 mYears = c.get(Calendar.YEAR);
  54.                 mMonths = c.get(Calendar.MONTH);
  55.                 mDates = c.get(Calendar.DAY_OF_MONTH);
  56.                 mHours = c.get(Calendar.HOUR_OF_DAY);
  57.                 mMinute = c.get(Calendar.MINUTE);
  58.  
  59.                 updateDisplay();
  60.         }
  61.  
  62.         private void updateDisplay() {
  63.                 tvDisplay.setText(new StringBuilder().append(mMonths).append("-")
  64.                                 .append(mDates).append("-").append(mYears).append("").append(
  65.                                                 pad(mHours)).append(":").append(pad(mMinute)));
  66.  
  67.         }
  68.  
  69.         private DatePicker.OnDateSetListener mDateListener = new DatePicker.OnDateSetListener() {
  70.                 public void dateSet(DatePicker view, int yearx, int monthOfYear,
  71.                                 int dateOfMonth) {
  72.                         mYears = yearx;
  73.                         mMonths = monthOfYear;
  74.                         mDates = dateOfMonth;
  75.                         updateDisplay();
  76.  
  77.                 }
  78.  
  79.         };
  80.  
  81.         private TimePicker.OnTimeSetListener mTimeListener = new TimePicker.OnTimeSetListener() {
  82.                 public void timeSet(TimePicker view, int hoursx, int minutex) {
  83.                         mHours = hoursx;
  84.                         mMinute = minutex;
  85.                         updateDisplay();
  86.                 }
  87.  
  88.         };
  89.  
  90.         private static String pad(int c) {
  91.                 if (c > 10) {
  92.                         return String.valueOf(c);
  93.                 } else {
  94.                         return "0".concat(String.valueOf(c));
  95.                 }
  96.         }
  97.  
  98. }
Parsed in 0.040 seconds, using GeSHi 1.0.8.4



this main.xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.         android:orientation="vertical" android:layout_width="fill_parent"
  4.         android:layout_height="fill_parent">
  5.  
  6.  
  7.         <LinearLayout android:layout_width="wrap_content"
  8.                 android:layout_height="wrap_content">
  9.                 <TextView android:layout_width="fill_parent"
  10.                         android:layout_height="wrap_content"
  11.                         android:text="Hello World, MyThirdAndroid" id="@+id/display" />
  12.         </LinearLayout>
  13.         <Button android:layout_width="wrap_content"
  14.                 android:layout_height="wrap_content" id="@+id/pickTime" />
  15.  
  16.         <Button android:layout_width="wrap_content"
  17.                 android:layout_height="wrap_content" id="@+id/pickDate" />
  18.  
  19. </LinearLayout>
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


[2550-11-19 22:29:32 - MyThirdAndroid] ActivityManager: Starting: Intent { comp={com.simetex/com.simetex.MyThirdAndroid} }
[2550-11-19 22:29:32 - MyThirdAndroid] ActivityManager: Error: Activity class {com.simetex/com.simetex.MyThirdAndroid} does not exist.



please advice me .
I'm new guy.
sumet
Freshman
Freshman
 
Posts: 5
Joined: Sat Nov 17, 2007 6:02 pm

Top

Postby plusminus » Mon Nov 19, 2007 5:47 pm

Hi sumet,

As your code compiles/runs fine on my Emulator, your bug is probably within the AndroidManifest.xml
please post it here.
As we all have good eyes, please use the standard font-size :) (changed it already)

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby ZA_Alligator » Thu Dec 06, 2007 11:40 pm

Hi Plusminus and sumet,

I've encountered this error many times as well, often when trying to run the simplest Android application i.e. the basic activity created when an Android project is created in Eclipse. I've found several references to the problem, but no-one has come up with a solution, or even a plausible explanation.

Hopefully you can help. Here is my source code and Android Manifest file. Good luck.

Al.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package za.co.aj;
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5.  
  6. public class Tester extends Activity {
  7.     /** Called when the activity is first created. */
  8.     @Override
  9.     public void onCreate(Bundle icicle) {
  10.         super.onCreate(icicle);
  11.         setContentView(R.layout.main);
  12.     }
  13. }
  14.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version=" 1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.    package=" za.co.aj">
  4.     <application android:icon="@drawable/icon">
  5.         <activity class=".Tester" android:label="@string/app_name">
  6.             <intent-filter>
  7.                 <action android:value=" android.intent.action.MAIN" />
  8.                 <category android:value="android.intent.category.LAUNCHER" />
  9.             </intent-filter>
  10.         </activity>
  11.     </application>
  12. </manifest>
  13.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


console output
Code: Select all
[2007-12-06 23:18:59 - Tester] ------------------------------
[2007-12-06 23:18:59 - Tester] Android Launch!
[2007-12-06 23:18:59 - Tester] Launching: za.co.aj.Tester
[2007-12-06 23:18:59 - Tester] Launching the emulator.
[2007-12-06 23:19:07 - Tester] Emulator is up! Waiting for HOME to be launched.
[2007-12-06 23:19:08 - Tester] HOME is up!
[2007-12-06 23:19:08 - Tester] Pushing Tester.apk to /data/app on the device
[2007-12-06 23:19:08 - Tester] Starting activity on device: za.co.aj.Tester
[2007-12-06 23:19:10 - Tester] ActivityManager: Starting: Intent { comp={za.co.aj/za.co.aj.Tester} }
[2007-12-06 23:19:10 - Tester] ActivityManager: Error: Activity class {za.co.aj/za.co.aj.Tester} does not exist.
ZA_Alligator
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Dec 06, 2007 10:16 pm
Location: Durban, South Africa

Postby plusminus » Thu Dec 06, 2007 11:50 pm

Hello ZA_Alligator,

there is a blank space in your package declaration(line #3):
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version=" 1.0" encoding="utf-8"?>
  2. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3.    package=" za.co.aj">
  4.     <application android:icon="@drawable/icon">
  5.         ...
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


Was that a typo :?: because when I do the same, my project does not compile properly.

Does the "Tester.apk" exist when you browse the "/data/app/"-Folder :?:

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby northvortex » Sun Dec 09, 2007 9:00 pm

Hi Sumet

I had the same problem and I couldn't find out a solution. However, I'm sure it was something related with the "AndroidManifest.xml" file. So, I took a shortcut and recreated my project and then the issue was fixed.
User avatar
northvortex
Freshman
Freshman
 
Posts: 4
Joined: Sun Dec 09, 2007 7:39 pm

Try cleaning your project

Postby gh » Fri Aug 21, 2009 1:08 am

I just came upon this post when I had the same issue. I cleaned my project (in Eclipse Project->Clean) and it resolved the problem. If this works for others, it would be less cumbersome.
gh
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 21, 2009 12:55 am

Top

Postby freewheelnat » Mon Sep 21, 2009 10:04 pm

I've just had the same problem tonight and found the error was an extra blank space between android:name and android:label in the activity tag of my manifest file.
freewheelnat
Developer
Developer
 
Posts: 40
Joined: Sat Aug 08, 2009 11:48 am
Location: London

Postby droider » Thu Mar 25, 2010 1:10 am

@plusminus, vortex

Thanks, I had a similar problem and finally figured out typo in AndroidManifest
hmm...how about a Google Certified Android Developer certification?!
droider
Developer
Developer
 
Posts: 25
Joined: Sun Mar 21, 2010 6:17 am
Location: New York

Re: ActivityManager: Error: Activity class {..} does not exi

Postby hippou » Thu May 20, 2010 2:49 pm

I had a similar problem with an example game Snake (part of SDK) when I was trying it in NetBeans IDE. The solution was add missing dot ahead name of activity.
Code: Select all
<activity android:name=".Snake">
hippou
Once Poster
Once Poster
 
Posts: 1
Joined: Thu May 20, 2010 2:34 pm

Re: ActivityManager: Error: Activity class {..} does not exi

Postby avuton » Mon Apr 11, 2011 11:26 am

I had the same problem today...
Project->Clean in Eclipse solved it... thank you...
avuton
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Apr 11, 2011 11:24 am

Re: ActivityManager: Error: Activity class {..} does not exi

Postby sanchir65 » Tue Nov 15, 2011 4:52 am

hi all, i have the same problem even though i don't have any of these space mistake. i even cleaned the project. but no difference.
and in by code, there is one thing that "startSubActivity(itemintent,0);" is it wrong?
sanchir65
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Nov 15, 2011 4:46 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 4 guests