Vikram Anand Bhushan
Vikram Anand Bhushan

Reputation: 4886

How to debug a cordova Hybrid app

So, I got my cordova app running on my remote device and I am trying to test the scanner, so it has to be tested on an android device itself.

But I do not know how I should check for the error its throwing because the scanner is not working in my mobile device.

Any help will be appreciated

Thanks

Upvotes: 2

Views: 3073

Answers (1)

Jay
Jay

Reputation: 1478

There are certain steps which need to be followed to debug Cordova app for Android.

Step 1: Install Android SDK tools in your system and ensure the commands are available in PATH.

Step 2: You need to enable Developer options menu in your phone settings. Once Developer options get enabled, then you can enable USB debugging option.

Step 3: Search for your Android phone ADB drivers and install them if using a Windows PC. This enables ADB to find your Android phone once connected via USB. One can easily find ADB drivers in phone manufacturer websites.

Step 4: Connect the phone via USB and confirm any USB debugging authorization permission modal displayed.

Step 5: Open the app under development in your phone. Also open Chrome browser in your system and then the link chrome://inspect/#devices in a tab.

Step 6: If your system has detected the phone and your app is open in the phone, then there will be an entry related to your app in the Chrome page opened above. Open the link to start Chrome Developer tools for your app.

Any JS errors thrown or logs printed by the Cordova JS code can be seen in Chrome Developer tools.

In case, there are issues in Android device detection itself, it can be due to below reasons:-

a) ADB drivers not installed.

b) ADB not installed

c) USB Cable not working or loose.

d) Developer Options and USB debugging not enabled in phone.

Once everything is sorted, one can debug Cordova JS/HTML codebase like a regular web app in Chrome.

Upvotes: 5

Related Questions