Reputation: 33
I'm working on an Ionic/Cordova cross-platform application and I'm struggling a little bit with the debugging.
Debug can of course be done directly from the browser by running ionic serve
and then using the browser developer tools, but some behaviors happen only on real devices.
Upvotes: 3
Views: 7811
Reputation: 41
for
Android you could open chrome://inspect/#devices (emulator/real device), then click inspect on needed webview.
IOS you could open safari Develop=>needed device(real/emulator) => choose needed application.
Upvotes: 0
Reputation: 2614
A simple way could be using logcat, take a look to this answer Debugging a WebView (Ionic) app on Android via logcat.
Upvotes: 0
Reputation: 1934
Adding a detailed guide to do this..
ionic cordova run android -l --external
chrome://inspect/#devices
If all was done correctly, you will see your device name and app name there with an option to inspect. This will open the chrome developer console exactly similar to the web one.
Now you can debug the app right on the device. Add breakpoints, edit html and see the logs as well.
Upvotes: 7
Reputation: 8859
Yes, you can use Chrome and Safari DevTools to connect to your device and debug the HTML/JS/CSS, as long as you don't build a release version (cordova build android ---release
). It does take some initial setup since it's disabled by default.
Or you can use Android Studio or XCode to debug the plugins etc.
Note that you can only debug iOS apps with a Mac (or using Google's iOS WebKit Debug Proxy). Android apps can be debugged from any OS with Chrome (for HTML/JS/CSS) or Android Studio installed.
Official Cordova debugging guide
Upvotes: 2