excilys/androidannotations — Issue #115: MapActivity yields ClassNotFoundException
Author: mmaker
Created: 2012-02-19 15:19:10+00:00
State: open

Apparently to me, it seems that using `@EActivity` decorator on a MapActivity class is buggy. This is what I tried:

```java
$ cat com/hello/annotations/HelloAnnotationsActivity.java
package com.hello.annotations;

import com.google.android.maps.MapActivity;
import com.googlecode.androidannotations.annotations.EActivity;

@EActivity(R.layout.main)
public class HelloAnnotationsActivity extends MapActivity {

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}

}
```

Layout:

```html
$ cat ../res/layout/main.xml

```

My Manifest:

```html

$ cat ../AndroidManifest.xml

```

That generates:

```
$ cat ~/log.txt
02-19 15:55:07.413: E/AndroidRuntime(333): FATAL EXCEPTION: main
02-19 15:55:07.413: E/AndroidRuntime(333): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hello.annotations/com.hello.annotations.HelloAnnotationsActivity_}: java.lang.ClassNotFoundException: com.hello.annotations.HelloAnnotationsActivity_ in loader dalvik.system.PathClassLoader[/data/app/com.hello.annotations-2.apk]
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.os.Handler.dispatchMessage(Handler.java:99)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.os.Looper.loop(Looper.java:123)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.ActivityThread.main(ActivityThread.java:4627)
02-19 15:55:07.413: E/AndroidRuntime(333):	at java.lang.reflect.Method.invokeNative(Native Method)
02-19 15:55:07.413: E/AndroidRuntime(333):	at java.lang.reflect.Method.invoke(Method.java:521)
02-19 15:55:07.413: E/AndroidRuntime(333):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-19 15:55:07.413: E/AndroidRuntime(333):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-19 15:55:07.413: E/AndroidRuntime(333):	at dalvik.system.NativeStart.main(Native Method)
02-19 15:55:07.413: E/AndroidRuntime(333): Caused by: java.lang.ClassNotFoundException: com.hello.annotations.HelloAnnotationsActivity_ in loader dalvik.system.PathClassLoader[/data/app/com.hello.annotations-2.apk]
02-19 15:55:07.413: E/AndroidRuntime(333):	at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
02-19 15:55:07.413: E/AndroidRuntime(333):	at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
02-19 15:55:07.413: E/AndroidRuntime(333):	at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-19 15:55:07.413: E/AndroidRuntime(333):	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
02-19 15:55:07.413: E/AndroidRuntime(333):	... 11 more
```

That's pretty strange, becouse after slightly changing the project to use Activity everything works ok:

```
$ cat src/com/hello/annotations/HelloAnnotationsActivity.java
package com.hello.annotations;

import android.app.Activity;

import com.googlecode.androidannotations.annotations.EActivity;

@EActivity(R.layout.main)
public class HelloAnnotationsActivity extends Activity {

}tumbolandia:HelloAnnotations maker$ cat res/layout/main.xml

```

Please let me know if you do prefer the code in other forms, such as a git repo - I thought the application was so simple that posting here was enough, or further informations - I'm currently using Eclipse, setted according to your beginner's guide.
Uh, and one last thing, I'm using androidannotations version 2.4 on my project.