Last modified: 2012-02-24 02:51:55 UTC
Using either the Android emulator or a Xoom tablet the app crashes with a process org.wikipedia has stopped unexpectedly message. If the app isn't supposed to work with Android 3.x lets at least put in a max api requirement. Otherwise lets fix the issue.
First filed at https://github.com/nitobi/Wikipedia/issues/9
E/AndroidRuntime( 555): FATAL EXCEPTION: main E/AndroidRuntime( 555): java.lang.NullPointerException E/AndroidRuntime( 555): at com.phonegap.menu.AppMenu$1.run(AppMenu.java:172) E/AndroidRuntime( 555): at android.os.Handler.handleCallback(Handler.java:587) E/AndroidRuntime( 555): at android.os.Handler.dispatchMessage(Handler.java:92) E/AndroidRuntime( 555): at android.os.Looper.loop(Looper.java:132) E/AndroidRuntime( 555): at android.app.ActivityThread.main(ActivityThread.java:4123) E/AndroidRuntime( 555): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime( 555): at java.lang.reflect.Method.invoke(Method.java:491) E/AndroidRuntime( 555): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) E/AndroidRuntime( 555): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) E/AndroidRuntime( 555): at dalvik.system.NativeStart.main(Native Method) The anonymous inner class in the backtrace is a UI-thread callback in buildHoneycombMenu() ... this is code that's only run on Android 3.x and seems to pull a Menu object out of ctx.dMenu which I can find no documentation on. If I change it to skip this when ctx.dMenu is null, it doesn't crash but the web view is limited to a tiny little square in the upper-left. Tested with Android 3.2 emulator image.
the ctx.dMenu is related to the menu plugin which gives PhoneGap access to the native menu on Android phones. it's possible that the plugin is not compatible with the Android tablets. I will verify if this is the case.
https://github.com/nitobi/Wikipedia/commit/2aa756f8e3d9d306e2b9f065dcc9f8941514d179
Still crashes in emulator running 3.2 as of commit f24fdd5449b020ac9a24f64abad9f07594fe6df8. 10-28 11:38:51.602: W/dalvikvm(589): threadid=1: thread exiting with uncaught exception (group=0x40014760) 10-28 11:38:51.612: E/AndroidRuntime(589): FATAL EXCEPTION: main 10-28 11:38:51.612: E/AndroidRuntime(589): java.lang.NullPointerException 10-28 11:38:51.612: E/AndroidRuntime(589): at com.phonegap.menu.AppMenu$1.run(AppMenu.java:173) 10-28 11:38:51.612: E/AndroidRuntime(589): at android.os.Handler.handleCallback(Handler.java:587) 10-28 11:38:51.612: E/AndroidRuntime(589): at android.os.Handler.dispatchMessage(Handler.java:92) 10-28 11:38:51.612: E/AndroidRuntime(589): at android.os.Looper.loop(Looper.java:132) 10-28 11:38:51.612: E/AndroidRuntime(589): at android.app.ActivityThread.main(ActivityThread.java:4123) 10-28 11:38:51.612: E/AndroidRuntime(589): at java.lang.reflect.Method.invokeNative(Native Method) 10-28 11:38:51.612: E/AndroidRuntime(589): at java.lang.reflect.Method.invoke(Method.java:491) 10-28 11:38:51.612: E/AndroidRuntime(589): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841) 10-28 11:38:51.612: E/AndroidRuntime(589): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 10-28 11:38:51.612: E/AndroidRuntime(589): at dalvik.system.NativeStart.main(Native Method) 10-28 11:38:57.272: I/Process(589): Sending signal. PID: 589 SIG: 9
likely broken by the changes in this commit. https://github.com/nitobi/Wikipedia/commit/139edec5e4b6e811d2c92651b9efa774a59d9d28#src/com/phonegap/menu/AppMenu.java
Commented out the code that creates an Action Bar specific menu for now. Honeycomb and Ice Cream Sandwich uses the Action Bar instead of using a Menu.
Fixed with this commit: https://github.com/nitobi/Wikipedia/commit/e2e13fc832cf48077580af04bf05f18507961e03https://github.com/nitobi/Wikipedia/commit/e2e13fc832cf48077580af04bf05f18507961e03 (Note: I also removed hard-tabs and replaced them with spaces)