Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a real solution to debug cordova apps [closed]

People also ask

How do I debug a Cordova app?

Connect your phone and execute adb devices in your terminal (not required on recent versions of Chrome), and select ok in the popup on your phone Allow USB debugging? . Open Chrome. Browse to chrome://inspect , or choose More tools => Inspect Devices... Select your device and debug using Chrome's developer tools.

How do I debug a Cordova app on safari?

To enable debugging on iOS, In the iOS device, go to Settings → Safari → Advanced → Enable 'Web Inspector' From the Mac, Safari → Preferences → Advanced → Enable 'Show Develop menu in menu bar' Once this is done, start the Cordova application and connect your iOS device with USB cable.

How do you debug an app on a real device?

On the device, open the Settings app, select Developer options, and then enable USB debugging (if applicable). Note: If you do not see Developer options, follow the instructions to enable developer options. Set up your system to detect your device. Chrome OS: No additional configuration required.


FOR ANDROID:

You only need to enable “USB remote debugger” within your android device and plug with a USB cable. Then open your application in the device. Chrome will detect the remote browser and you can see the console in the same way than you see it when you use Chrome locally.

Use this link: chrome://inspect/#devices in Chrome browser (you'll have to paste it into the nav bar).

If your app crashes in the device you only need to see the console’s log within your browser and see what happens. You also can add functionality, change variables, and override functions in the same way than we do it with our local browser.

Read this article for more information on the steps to take.

This will work ONLY with devices running Android 4.4+.

FOR iOS:

Use Safari for iOS, follow these steps:

1.In your iOS device go to Settings > Safari > Advanced > Web Inspector to enable Web Inspector

2.Open Safari on your iOS device.

3.Connect it to your computer via USB.

4.Open Safari on your computer.

5.In Safari’s menu, go to Develop and, look for your device’s name.

6.Select the tab you want to debug.

enter image description here


NOTICE

This answer is old (January 2014) many new debugging solutions are available since then.


I finally got it working! using weinre and cordova (no Phonegap build) and to save hassle for future devs, who may face the same problem, I made a YouTube tutorial ;)


If you can use an Android 4.4+ device, then you can use Chrome Remote Debugging even on the app's internal WebView. It's a much better debugger than Weinre, but the key is using the recent Android version.

Recent Cordova builds automatically enable this kind of debugging as long as it's a debug build (it's turned off in --release builds).


The best for me is to attach the Chrome debugger.

To do it, run your app in a emulator or device (using $cordova emulate)

then, open Google Chrome and go to chrome://inspect/

You'll see a list with running apps. Your app should be there. Click on "inspect".

A new window will open with developer tools. There you can click on "console" to check for errors


If your app is running Cordova 3.3+ and your device is running Android 4.4+ then you can use Chrome Remote Webview Debugging to debug your Cordova app.

To be able to do that, you must first enable USB debugging on you phone.

Then open the "inspect devices" tab. In Chrome, go to Settings > More tools > Inspect devices.

If you launch your app on your device while it's connected to your computer, The Webview should appear in the devices list. Click on the "Inspect" link of your Webview and a Debug Tool for your Webview should appear.

Here is an article fully explaining how to do it: http://geeklearning.io/apache-cordova-and-remote-debugging-on-android/