Debugging and Testing

Debug and Test Overview  

The Intel® XDK provides multiple ways to debug and test your app. This topic provides a summary of the debugger and device preview/test features, and helps you choose which features to use based on your current development needs.

Simulate Tab  

Use the simulator in the Simulate tab to quickly view changes you make to your project files and check the functionality and layout of your hybrid app on a collection of virtual mobile devices. Use this tab to open a version of the Google Chrome* Developer Tools (CDT) debugger and directly debug your app's JavaScript* code, Cordova plugins, CSS rules, and DOM elements. After you test and debug your app, run and test your app on a real mobile device.

Device Simulator Limitations  

This topic explains why running an app in the device simulator differs from running it on actual device(s).

Test Tab  

NOTE: As of August 16, 2017, Intel App Preview has been retired and is no longer available in the respective mobile app stores; if you already have a copy of Intel App Preview on your test device it will continue to work, but you can no longer download it from a mobile store for new installations.

Using Remote Chrome DevTools to Debug Android* Cordova* Apps 

Using the Google* Chrome browser on your workstation with Chrome* DevTools running on your Android device (remote CDT) is a very powerful debugging environment. Using remote CDT, you can debug a built app as it runs directly on your device. Nearly 100 percent of the functionality of Chrome DevTools is available to you; it's as if you are debugging a browser app on your local workstation.

Using Web Inspector Remote to Debug iOS* Cordova Apps  

If you own a Mac* and an Apple* developer account, you can utilize Web Inspector in Safari* to remotely debug an iOS* Cordova app in a way that is analogous to using Remote Chrome* DevTools with an Android* device running a Cordova app. This process requires that you use a Mac and that your iOS device is attached to the Mac via a USB cable.

Using Node weinre to Debug Cordova* Apps  

For situations where you cannot use remote debug over USB to your Android device or remote debug of your iOS device over USB with a Mac and Safari Web Inspector, weinre is a useful alternate solution. Using the weinre remote console from your desktop browser provides access to a JavaScript console in your built app that is similar to the JavaScript console found in most desktop browsers. This solution does not support JavaScript single-stepping or breakpoints, and it has limited CSS debug tools.

Debug Tab   [RETIRED]

NOTE: As of December 12, 2016, the Intel® XDK Debug tab has been retired. You can no longer build debug modules with any version of the Intel XDK.

We recommend that you use the Simulate tab for basic debugging. You can debug a built Android app directly on-device, with full JavaScript and CSS debugging, by way of remote Chrome* DevTools*. For those who have access to a Mac, it is also possible to use remote web inspector with Safari to debug your built iOS app directly on-device.

In addition, you can use weinre by installing a weinre server directly onto your development system. For additional help on using weinre locally, watch Using WEINRE to Debug an Intel® XDK Cordova* App (beginning at about 14:30 in the video).

Debugging a built app does not require rebuilding your app to test changes or to experiment with your code. The best debugging experience will come from taking advantage of the interactive JavaScript console to redefine functions within your app and then run those redefined functions directly from the console or by restarting your app, in situ, using the window.location.reload() function. An example of using this technique can be seen in this video, starting at about 18:30. The video is demonstrating the use of the weinre debugger, but the debugging techniques can also be applied to remote CDT and remote Web Inspector when debugging a built app.

NOTE: Intel App Preview for Android is distributed with remote debug enabled. This means that you can use remote CDT to debug your app within App Preview using a USB connection, as long as you restrict your debugging efforts to only that code which interacts with the core Cordova plugins. App Preview does not support third-party plugins, only the "core" Cordova plugins; therefore, you cannot debug those parts of your app that interact with third-party Cordova plugin APIs within App Preview (this has always been a restriction of App Preview).

See Also

For more complete information about compiler optimizations, see our Optimization Notice.