Alexandru Nicau created CB-1128: ----------------------------------- Summary: crash while running the Accelerometer documentation example on a 2.3.5 device Key: CB-1128 URL: https://issues.apache.org/jira/browse/CB-1128 Project: Apache Cordova Issue Type: Bug Components: Android Affects Versions: 2.0.0 Environment: eclipse sdk 4.2 on win32, android sdk r20.0.1 win, adt 20.0.2, cordova-2.0.0, the device is a samsung galaxy s gt-i9000 running android 2.3.5 gingerbread xxjvt Reporter: Alexandru Nicau Assignee: Joe Bowser
Have implemented the Accelerometer full example (from the documentation) and after a few seconds of correct execution it crashes. The situation can be duplicated easily and happens every time. The Java code is: public class MainActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setStringProperty("loadingDialog", "Title,Message"); super.setStringProperty("errorUrl", "file:///android_asset/www/error.html"); super.init(); super.appView.clearCache(true); super.setBooleanProperty("keepRunning", false); super.loadUrl("file:///android_asset/www/index.html"); } } The HTML code is a copy-paste from the example at http://docs.phonegap.com/en/2.0.0/cordova_accelerometer_accelerometer.md.html#Accelerometer , accelerometer.watchAcceleration section, the full code sample. That's where a watch is added on the accelerometer, executing the onSuccess() every 3 seconds, which updates some div. Running the application updates the div but only for a variable number of times (maybe one to three updates). The errors we're seeing bellow are at a point when a spinner dialog is about to be shown, but its view cannot be added to the view manager (or the view manager cannot instantiate a new view, don't know code details). Both, IMHO are side effects of the real reasons. If I remove the "loadingDialog" property, the application keeps on crashing, but more quietly than we may see bellow. 07-23 16:57:51.637: D/DroidGap(1421): DroidGap.init() 07-23 16:57:51.660: D/CordovaWebView(1421): >>> loadUrl(file:///android_asset/www/index.html) 07-23 16:57:51.660: D/PluginManager(1421): init() 07-23 16:57:51.664: D/CordovaWebView(1421): >>> loadUrlNow() 07-23 16:57:51.664: D/WML_SISO(1421): InitPasteboardJni 07-23 16:57:51.692: D/SoftKeyboardDetect(1421): Ignore this event 07-23 16:57:51.696: V/webview(1421): OnSizeChanged: Enter 07-23 16:57:51.696: D/DroidGap(1421): onMessage(onPageStarted,about:blank) 07-23 16:57:51.723: D/SoftKeyboardDetect(1421): Ignore this event 07-23 16:57:51.742: D/Cordova(1421): onPageFinished(about:blank) 07-23 16:57:51.742: D/DroidGap(1421): onMessage(onPageFinished,about:blank) 07-23 16:57:51.742: D/DroidGap(1421): onMessage(exit,null) 07-23 16:57:51.742: D/CordovaWebView(1421): >>> loadUrlNow() 07-23 16:57:51.750: I/TvOut-Observer(137): setTvoutOrientation rotation = 0 07-23 16:57:51.750: E/TvOut-Observer(137): SetOrientation 07-23 16:57:51.750: I/TvOut-Client(137): SetOrientation + 07-23 16:57:51.750: I/TvOut-Client(137): SetOrientation - 07-23 16:57:51.750: I/WindowManager(137): Setting rotation to 0, animFlags=1 07-23 16:57:51.754: D/PhoneApp(233): updateProximitySensorMode: state = IDLE 07-23 16:57:51.754: D/PhoneApp(233): updateProximitySensorMode: lock already released. 07-23 16:57:51.754: I/ActivityManager(137): Config changed: { scale=1.0 imsi=226/1 loc=en_GB touch=3 keys=1/1/2 nav=1/1 orien=1 layout=34 uiMode=17 seq=21 FlipFont=0} 07-23 16:57:51.793: I/Launcher(262): onResume(). mIsNewIntent : false 07-23 16:57:51.797: I/ActivityManager(137): No longer want com.cooliris.media (pid 1227): hidden #16 07-23 16:57:51.805: E/(262): onResume() check 0 07-23 16:57:51.805: E/(262): onResume() check 1 07-23 16:57:51.805: E/Launcher(262): setWindowOpaque() 07-23 16:57:51.852: D/FastDormancy(233): before ======= ENTER DORMANCY ======= 07-23 16:57:51.852: D/FastDormancy(233): [FD] ON default: true 07-23 16:57:51.852: D/FastDormancy(233): Before mDormFlag: false in getCapaDormancy() 07-23 16:57:51.852: D/FastDormancy(233): After mDormFlag: false in getCapaDormancy() 07-23 16:57:51.875: E/(262): onResume() check 2, mRestoring : false 07-23 16:57:51.875: E/(262): onResume() check 3 07-23 16:57:51.875: E/(262): onResume() check 4 07-23 16:57:51.875: E/(262): onResume() check 5 07-23 16:57:51.879: I/Launcher(262): onResume() ended 07-23 16:57:51.883: I/Launcher(262): onWindowFocusChanged(true) 07-23 16:57:51.883: D/Launcher(262): It's image wallpaper. suggestDesiredDimensions(-1,-1) 07-23 16:57:51.887: E/Launcher(262): setWindowOpaque() 07-23 16:57:51.938: D/DroidGap(1421): onDestroy() 07-23 16:57:51.985: D/CordovaWebView(1421): >>> loadUrlNow() 07-23 16:57:51.985: D/CordovaWebView(1421): >>> loadUrlNow() 07-23 16:57:51.996: I/Database(1421): sqlite returned: error code = 14, msg = cannot open file at source line 25467 07-23 16:57:52.000: E/WindowManager(1421): Activity com.example.the_app_andr.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40595918 that was originally added here 07-23 16:57:52.000: E/WindowManager(1421): android.view.WindowLeaked: Activity com.example.the_app_andr.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40595918 that was originally added here 07-23 16:57:52.000: E/WindowManager(1421): at android.view.ViewRoot.<init>(ViewRoot.java:263) 07-23 16:57:52.000: E/WindowManager(1421): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:171) 07-23 16:57:52.000: E/WindowManager(1421): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:114) 07-23 16:57:52.000: E/WindowManager(1421): at android.view.Window$LocalWindowManager.addView(Window.java:424) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.Dialog.show(Dialog.java:241) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ProgressDialog.show(ProgressDialog.java:107) 07-23 16:57:52.000: E/WindowManager(1421): at org.apache.cordova.DroidGap.spinnerStart(DroidGap.java:761) 07-23 16:57:52.000: E/WindowManager(1421): at org.apache.cordova.DroidGap.loadSpinner(DroidGap.java:388) 07-23 16:57:52.000: E/WindowManager(1421): at org.apache.cordova.DroidGap.loadUrl(DroidGap.java:354) 07-23 16:57:52.000: E/WindowManager(1421): at com.example.the_app_andr.MainActivity.onCreate(MainActivity.java:29) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2836) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ActivityThread.access$1600(ActivityThread.java:117) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939) 07-23 16:57:52.000: E/WindowManager(1421): at android.os.Handler.dispatchMessage(Handler.java:99) 07-23 16:57:52.000: E/WindowManager(1421): at android.os.Looper.loop(Looper.java:130) 07-23 16:57:52.000: E/WindowManager(1421): at android.app.ActivityThread.main(ActivityThread.java:3687) 07-23 16:57:52.000: E/WindowManager(1421): at java.lang.reflect.Method.invokeNative(Native Method) 07-23 16:57:52.000: E/WindowManager(1421): at java.lang.reflect.Method.invoke(Method.java:507) 07-23 16:57:52.000: E/WindowManager(1421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) 07-23 16:57:52.000: E/WindowManager(1421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 07-23 16:57:52.000: E/WindowManager(1421): at dalvik.system.NativeStart.main(Native Method) 07-23 16:57:52.004: W/IInputConnectionWrapper(1421): showStatusIcon on inactive InputConnection 07-23 16:57:52.067: V/webview(1421): ZoomScale 3 mPreserveZoom: false 07-23 16:57:52.157: D/DroidGap(1421): onMessage(onPageStarted,file:///android_asset/www/index.html) 07-23 16:57:52.180: D/CordovaLog(1421): exception firing pause event from native 07-23 16:57:52.180: D/CordovaLog(1421): undefined: Line 1 : exception firing pause event from native 07-23 16:57:52.180: I/Web Console(1421): exception firing pause event from native at undefined:1 07-23 16:57:52.192: D/CordovaLog(1421): exception firing destroy event from native 07-23 16:57:52.192: D/CordovaLog(1421): undefined: Line 1 : exception firing destroy event from native 07-23 16:57:52.192: I/Web Console(1421): exception firing destroy event from native at undefined:1 07-23 16:57:52.196: D/Cordova(1421): onPageFinished(file:///android_asset/www/index.html) 07-23 16:57:52.196: D/CordovaWebView(1421): >>> loadUrlNow() 07-23 16:57:52.196: D/DroidGap(1421): onMessage(onNativeReady,null) 07-23 16:57:52.196: D/DroidGap(1421): onMessage(onPageFinished,file:///android_asset/www/index.html) 07-23 16:57:52.207: D/DroidGap(1421): onMessage(onPageStarted,about:blank) 07-23 16:57:52.207: D/Cordova(1421): onPageFinished(about:blank) 07-23 16:57:52.207: D/DroidGap(1421): onMessage(onPageFinished,about:blank) 07-23 16:57:52.211: D/DroidGap(1421): onMessage(exit,null) 07-23 16:57:52.215: V/webview(1421): ZoomScale 3 mPreserveZoom: false 07-23 16:57:52.590: I/StatusBarPolicy(221): onSignalStrengthsChanged 07-23 16:57:52.633: I/StatusBarPolicy(221): onSignalStrengthsChanged 07-23 16:57:53.192: W/PowerManagerService(137): Timer 0x1->0x0|0x0 07-23 16:57:53.192: I/PowerManagerService(137): Ulight 1->0|0 07-23 16:57:53.219: D/LightsService(137): BKL : 18 07-23 16:57:53.254: D/LightsService(137): BKL : 16 07-23 16:57:53.285: D/LightsService(137): BKL : 14 07-23 16:57:53.313: D/LightsService(137): BKL : 12 07-23 16:57:53.336: D/LightsService(137): BKL : 10 07-23 16:57:53.367: D/LightsService(137): BKL : 8 07-23 16:57:53.391: D/LightsService(137): BKL : 6 07-23 16:57:53.414: D/LightsService(137): BKL : 4 07-23 16:57:53.442: D/LightsService(137): BKL : 2 07-23 16:57:53.465: E/power(137): *** set_screen_state 0 07-23 16:57:53.465: D/LightsService(137): BKL : 0 07-23 16:57:53.465: I/PowerManagerService(137): Light Animator Finished curIntValue=0 07-23 16:57:53.465: D/PowerManagerService(137): enableLightSensor false 07-23 16:57:53.469: E/SensorManager(137): unregisterListener:: all sensors, listener = com.android.server.PowerManagerService$13@405168e0 07-23 16:57:53.489: D/LightsService(137): BUTTON : 0 07-23 16:57:53.489: W/PowerManagerService(137): CurLockF mPS:0 mUS=0 07-23 16:57:53.489: W/PowerManagerService(137): mPokeLocks.size=0: 07-23 16:57:53.492: D/PowerManagerService(137): sendNotificationLocked on=false 07-23 16:57:53.500: E/SensorManager(137): unregisterListener:: all sensors, listener = android.view.WindowOrientationListener$SensorEventListenerImpl@406cab20 07-23 16:57:53.504: D/SurfaceFlinger(137): About to give-up screen, flinger = 0x1107e8 07-23 16:57:53.508: V/WindowManager(137): Setting event dispatching to false 07-23 16:57:53.512: I/Launcher(262): onPause() 07-23 16:57:53.524: I/TvOut-Observer(137): ACTION android.intent.action.SCREEN_OFF 07-23 16:57:53.524: I/TvOut-Observer(137): tvOutSetImageString BroadcastReceiver broadcast received 07-23 16:57:53.524: I/TvOut-Observer(137): ACTION_SCREEN_OFF 07-23 16:57:53.524: I/TvOut-Observer(137): updateTVoutOnScreenOnOff tvstatus off mTvCableConnected : false 07-23 16:57:53.535: I/StatusBarPolicy(221): onDataActivity-D:0 07-23 16:57:53.535: I/StatusBarPolicy(221): onDataActivity-D:0 07-23 16:57:53.539: D/FastDormancy(233): [FD] INTENT ACTION android.intent.action.SCREEN_OFF 07-23 16:57:53.539: D/FastDormancy(233): [FD] mIsScreenOn: false 07-23 16:57:53.543: I/Launcher(262): ACTION_SCREEN_OFF 07-23 16:57:53.555: V/SettingsProvider(137): system <- value=1 name=phone_lock_status 07-23 16:57:53.555: V/SettingsProvider(137): property: sys.settings_system_version=45 07-23 16:57:53.555: D/PowerManagerService(137): setScreenOffTimeouts mKeylightDelay=3000 mDimDelay=5000 mScreenOffDelay=7000 mDimScreen=true 07-23 16:57:53.559: V/SettingsProvider(137): notifying: content://settings/system/phone_lock_status 07-23 16:57:53.934: D/dalvikvm(137): GC_EXPLICIT freed 955K, 43% free 6643K/11463K, external 6342K/7920K, paused 101ms 07-23 16:57:54.207: D/DroidGap(1421): onMessage(spinner,stop) 07-23 16:57:54.207: D/AndroidRuntime(1421): Shutting down VM 07-23 16:57:54.207: W/dalvikvm(1421): threadid=1: thread exiting with uncaught exception (group=0x40015578) 07-23 16:57:54.239: E/AndroidRuntime(1421): FATAL EXCEPTION: main 07-23 16:57:54.239: E/AndroidRuntime(1421): java.lang.IllegalArgumentException: View not attached to window manager 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:378) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:223) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.view.Window$LocalWindowManager.removeView(Window.java:432) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.app.Dialog.dismissDialog(Dialog.java:278) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.app.Dialog.access$000(Dialog.java:71) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.app.Dialog$1.run(Dialog.java:111) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.app.Dialog.dismiss(Dialog.java:268) 07-23 16:57:54.239: E/AndroidRuntime(1421): at org.apache.cordova.DroidGap.spinnerStop(DroidGap.java:774) 07-23 16:57:54.239: E/AndroidRuntime(1421): at org.apache.cordova.DroidGap.onMessage(DroidGap.java:1046) 07-23 16:57:54.239: E/AndroidRuntime(1421): at org.apache.cordova.api.PluginManager.postMessage(PluginManager.java:327) 07-23 16:57:54.239: E/AndroidRuntime(1421): at org.apache.cordova.CordovaWebView.postMessage(CordovaWebView.java:470) 07-23 16:57:54.239: E/AndroidRuntime(1421): at org.apache.cordova.CordovaWebViewClient$1$1.run(CordovaWebViewClient.java:292) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.os.Handler.handleCallback(Handler.java:587) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.os.Handler.dispatchMessage(Handler.java:92) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.os.Looper.loop(Looper.java:130) 07-23 16:57:54.239: E/AndroidRuntime(1421): at android.app.ActivityThread.main(ActivityThread.java:3687) 07-23 16:57:54.239: E/AndroidRuntime(1421): at java.lang.reflect.Method.invokeNative(Native Method) 07-23 16:57:54.239: E/AndroidRuntime(1421): at java.lang.reflect.Method.invoke(Method.java:507) 07-23 16:57:54.239: E/AndroidRuntime(1421): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) 07-23 16:57:54.239: E/AndroidRuntime(1421): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 07-23 16:57:54.239: E/AndroidRuntime(1421): at dalvik.system.NativeStart.main(Native Method) 07-23 16:57:54.254: I/Process(1421): Sending signal. PID: 1421 SIG: 9 07-23 16:57:54.262: I/ActivityManager(137): Process com.example.the_app_andr (pid 1421) has died. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira