tags:

views:

35

answers:

2

I get a class not found exception.

I have included the required entry in manifest file. The code in current activity is as follows:

 Intent i = new Intent(MainListingA.this, DrawTheatreMap.class);

            try{
             startActivity(i); 

            }

........

The error I get is as follows:

07-26 23:03:20.259: WARN/dalvikvm(307): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-26 23:03:20.397: ERROR/AndroidRuntime(307): FATAL EXCEPTION: main
07-26 23:03:20.397: ERROR/AndroidRuntime(307): java.lang.NoClassDefFoundError: com.mobilo.movie.DrawTheatreMap
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at com.mobilo.movie.MainListingA$1.onItemClick(MainListingA.java:101)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.widget.AdapterView.performItemClick(AdapterView.java:284)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.widget.ListView.performItemClick(ListView.java:3382)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.os.Handler.handleCallback(Handler.java:587)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.os.Looper.loop(Looper.java:123)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at android.app.ActivityThread.main(ActivityThread.java:4627)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at java.lang.reflect.Method.invokeNative(Native Method)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at java.lang.reflect.Method.invoke(Method.java:521)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-26 23:03:20.397: ERROR/AndroidRuntime(307):     at dalvik.system.NativeStart.main(Native Method)

Any help is highly appreciated.

On a standalone basis, the same map activity works fine.

Rgds, PP

A: 

I usually encounter that error when the application is being run on an emulator that lacks the Google APIs, because Android cannot find the MapActivity class.

CommonsWare
Not in this case! I have used Google Maps API to create the project. Also couple of additional details that may help you to review my problem: The error is when I am creating the intent and passing a class that extends MapActivity. . Secondly, If I replace this with any other type of activity, the whole thing works. Any idea whats goiong wrong?
@user395482: "I have used Google Maps API to create the project." -- that has nothing do to with it. "Any idea whats goiong wrong?" -- as I wrote, I usually encounter that error when the application is being run on an emulator that lacks the Google APIs, because Android cannot find the MapActivity class. Make sure your *emulator AVD* has the Google APIs.
CommonsWare
@CommonsWare: I have the same problem as @user395482 and your answer seems reasonable. But how do I make sure the emulator have the Google APIs? I created a new AVD and have chosen "Google APIs (Google Inc.)" as the "Target Name". Should that do the trick...?
Tim Büthe
@Tim Büthe: Yes. You can also tell by the fact that it has the Google Maps application available from the launcher.
CommonsWare
@CommonsWare: Well, then I have the Google API in place. Seems like my NoClassDefFound comes from somewhere else...
Tim Büthe
Found it, see my answer.
Tim Büthe
A: 

You might have the -Tag in the wrong place, at least that was my problem once and the Eclipse / the Google SDK does not complain about that. It has to be under , different to uses-permission which goes beside the application-Tag.

It should look like this:

<manifest ...>

    <uses-permission android:name="android.permission.INTERNET" />

    <application ...>

        <uses-library android:name="com.google.android.maps" />

    </application>

</manifest>
Tim Büthe