Debugging is a process that consists of finding the cause of defects in applicative code and application user interface.
- Native code can be debugged by using standard tools that are provided by the platform SDK, such as XCode, Android, or Microsoft Visual Studio.
Learn more about Cordova debugging and testing in the Cordova website: Debugging applications.
- Debugging with the Mobile Browser Simulator
- Debugging with Ripple
- Debugging with iOS Remote Web Inspector
- Debugging with Chrome Remote Web Inspector
- Debugging with MobileFirst Logger
- Debugging with WireShark
Debugging with the Mobile Browser Simulator
You can use the IBM Mobile Foundation Mobile Browser Simulator (MBS) to preview and debug MobileFirst applications.
To use the MBS, open a Command-line window and run the command:
mfpdev app preview
If your application consists of more than one platform - specify the platform to preview:
mfpdev app preview -p <platform>
Important: The preview feature has several known limitations. Your application may not behave as expected during preview. For example, it bypasses security features using a confidential client, so challenge handlers are not triggered.
Mobile Browser Simulator
Learn more about the MobileFirst CLI in the Using MobileFirst CLI to manage MobileFirst artifacts tutorial.
Debugging with Ripple
Apache Ripple™ is a web based mobile environment simulator for debugging mobile web applications.
It lets you run a Cordova application in your browser and fake various Cordova features. For example, it can fake the camera API by letting you select a picture locally from your computer.
- Download and install the latest version of Node.js.
You can verify Node.js installation by typing
npm -vin terminal.
Open terminal and type:
npm install -g ripple-emulator
Running application using Ripple
After Ripple is installed open terminal from your Cordova project location and type:
More information about Apache Ripple™ can be found on the Apache Ripple page or npm ripple-emulator page.
Debugging with iOS Remote Web Inspector
Starting iOS 6, Apple introduced a remote Web Inspector for debugging web applications on iOS devices. To debug, make sure that the device (or iOS Simulator) has the Private Browsing option turned off.
- To enable Web Inspector on the device, Tap Settings > Safari > Advanced > Web Inspector.
- To start debugging, connect the iOS device to a Mac, or start the simulator.
- In Safari, go to Preferences > Advanced, and select the Show Develop menu in menu bar checkbox.
- In Safari, select Develop > [your device ID] > [your application HTML file].
Debugging with Chrome Remote Web Inspector
Using Google Chrome it is possible to remotely inspect web applications on Android devices or the Android Emulator.
This action requires Android 4.4 or later, Chrome 32 or later. Additionally, in the
targetSdkVersion = 19 or above is required. In the
target = 19 or above is required.
- Start the application in the Android Emulator or a connected device.
- In Chrome, enter the following URL in the address bar:
- Press Inspect for the relevant application.
Debugging with MobileFirst Logger
Mobile Foundation provides a
WL.Logger object that can be used to print log messages.
WL.Logger contains several levels of logging:
For more information, see the documentation for
WL.Loggerin the API reference part of the user documentation.
Inspecting the log:
- Developer console when previewing a platform using a Simulator or Emulator.
- LogCat when it is running on Android device
- XCode Console when it is running on an iOS device
- Visual Studio Output when it is running on a Windows devices.
Debugging with WireShark
Wireshark is a network protocol analyzer that can be used to see what happens in the network.
You can use filters to follow only what is required.
For more information, see the WireShark website.
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.