There is a known issue where the class loader won't know about MapActivity from the <uses-library> tag in the case you described. Search this group for more details and possible workarounds.
j On Tue, Nov 10, 2009 at 3:12 PM, Himanshu <[email protected]> wrote: > Hi > > We have discovered a potential bug in the implementation of > AppWidgets. Here is a simple reproducer. > > Attached is the code for an application containing a TestActivity and > a TestWidget. TestActivity extends MapActivity and TestWidget is a > simple widget provider which updates a TextView every 2 seconds. > Now if the TestActivity is launched with no instance of TestWidget > running, it works just fine. But if the TestActivity is launched after > placing the TestWidget on the home, it results in > ClassNotFoundException. Here is what we get: > > I/ActivityManager( 584): Starting activity: Intent > { action=android.intent.action.MAIN categories= > {android.intent.category.LAUNCHER} flags=0x10200000 comp= > {com.example.test/com.example.test.TestActivity} } > W/dalvikvm( 1441): Unable to resolve superclass of Lcom/example/test/ > TestActivity; (15) > W/dalvikvm( 1441): Link of class 'Lcom/example/test/TestActivity;' > failed > D/AndroidRuntime( 1441): Shutting down VM > W/dalvikvm( 1441): threadid=3: thread exiting with uncaught exception > (group=0x4000fe70) > E/AndroidRuntime( 1441): Uncaught handler: thread main exiting due to > uncaught exception > E/AndroidRuntime( 1441): java.lang.RuntimeException: Unable to > instantiate activity ComponentInfo{com.example.test/ > com.example.test.TestActivity}: java.lang.ClassNotFoundException: > com.example.test.TestActivity in loader > dalvik.system.pathclassloa...@49a52110 > E/AndroidRuntime( 1441): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2194) > E/AndroidRuntime( 1441): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > 2284) > E/AndroidRuntime( 1441): at android.app.ActivityThread.access$1800 > (ActivityThread.java:112) > E/AndroidRuntime( 1441): at android.app.ActivityThread > $H.handleMessage(ActivityThread.java:1692) > E/AndroidRuntime( 1441): at android.os.Handler.dispatchMessage > (Handler.java:99) > E/AndroidRuntime( 1441): at android.os.Looper.loop(Looper.java: > 123) > E/AndroidRuntime( 1441): at android.app.ActivityThread.main > (ActivityThread.java:3948) > E/AndroidRuntime( 1441): at java.lang.reflect.Method.invokeNative > (Native Method) > E/AndroidRuntime( 1441): at java.lang.reflect.Method.invoke > (Method.java:521) > E/AndroidRuntime( 1441): at com.android.internal.os.ZygoteInit > $MethodAndArgsCaller.run(ZygoteInit.java:782) > E/AndroidRuntime( 1441): at com.android.internal.os.ZygoteInit.main > (ZygoteInit.java:540) > E/AndroidRuntime( 1441): at dalvik.system.NativeStart.main(Native > Method) > E/AndroidRuntime( 1441): Caused by: java.lang.ClassNotFoundException: > com.example.test.TestActivity in loader > dalvik.system.pathclassloa...@49a52110 > E/AndroidRuntime( 1441): at dalvik.system.PathClassLoader.findClass > (PathClassLoader.java:243) > E/AndroidRuntime( 1441): at java.lang.ClassLoader.loadClass > (ClassLoader.java:573) > E/AndroidRuntime( 1441): at java.lang.ClassLoader.loadClass > (ClassLoader.java:532) > E/AndroidRuntime( 1441): at android.app.Instrumentation.newActivity > (Instrumentation.java:1097) > E/AndroidRuntime( 1441): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > 2186) > E/AndroidRuntime( 1441): ... 11 more > > So it seems we have an inconsistency in the way the class loader works > for the same apk. > > WORKS - Launch the application by itself, without invoking the Widget. > DOES NOT WORK - Create a Widget on the Home screen and then launch the > application from the launcher. > > The source code for this application (http://www.yousendit.com/ > download/TzY3ZGVhZy96NE4zZUE9PQ) has been attached. Hope someone from > the Android team can shed light on this behavior. > > BTW, this error is seen on the 1.5r3 SDK. Not sure if this has been > addressed in 1.6 and 2.0 SDKs.. > > Thanks, > Himanshu. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Jeff Sharkey [email protected] -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

