Understand the Mobile Development Cycle
Debug Mobile Components
Previous Versions
To debug your components, connect your desktop browsers to the Salesforce mobile app running on your virtual devices. Then use Safari (iOS) or Chrome (Android) developer tools to view and interact with HTML markup, step through JavaScript code, and see console logging and error messages.
You can debug the web-based code of your component, but you can’t debug the platform native code of the mobile app.
Note
Virtual device builds of the Salesforce mobile app let you preview your mobile Lightning web components on a wide range of simulated Android and iOS devices. To install a build into a simulated device, see Preview Components in the Salesforce Mobile App.
To verify your component when running on iOS, use Safari Web Inspector.
To enable Safari’s developer tools, including Web Inspector, follow these steps.
Safari developer tools are located in the Develop menu, and are active until you turn them off by reversing the preceding steps.
To debug a mobile component, connect your desktop instance of Safari to the Salesforce mobile app running on your virtual device.
When you interact with your component in the simulated device, a new Web Inspector window opens. Use Web Inspector to debug your component in much the same way you debug it when it’s running directly in Safari on your desktop.
To learn more about using Safari Web Inspector, see webkit.org/web-inspector/enabling-web-inspector/.
To debug your components when running on Android, use Chrome DevTools. First, enable Developer Mode on your emulated device.
To debug a mobile component, connect your desktop instance of Google Chrome to the Salesforce mobile app running on your virtual device.
chrome://inspect/#devices.Chrome opens a remote debugging window. On the left is the current webview in the Android emulator, which is the page holding your mobile component. On the right is Chrome DevTools, which you can use to debug your component as if it were running in Chrome on your desktop.
To learn more about using Chrome DevTools, see developers.google.com/web/tools/chrome-devtools/remote-debugging.
See Also