Debugging Android Cordova/Phonegap Apps with Chrome
Join the DZone community and get the full member experience.Join For Free
maybe this post is a littleobvious but i’ve spoken about it with various developers who don’t know it. it really improves the development process for cordova/phonegap apps on android, at least for me.
with android we can see the log with “adb logcat” but it’s a nightmare. huge amount of information about our app and also about the operating system. if we’re grep ninjas we can handle it, but as well as i’m not a ninja i prefer another solution. do you know “chrome://inspect/”? if not, have a look as soon as possible to this tool. we can see the browser’s console of our android in our desktop browser. we only need to enable “usb remote debugger” within our android device and plug with a usb cable. chrome will detect the remote browser and we can see the console in the same way than we see it when we use chrome locally.
but we’re speaking about cordova/phonegap apps here so, what we need to do to use chrome://inspect with our hybrid apps? the answer is simple: we don’t need to do anything. cordova applications is nothing than a webkit browser inside a native app. chrome es webkit too so chrome://inspect will detect our remote device app and we will open console.
this small trick in addition to the last post really marks a before and an after at least in my developing process.
if our app crashes in the device we only need to see the console’s log within our browser and see what happens. we also can add functionality, change variables, and override functions in the same way than we do it with our local browser.
Published at DZone with permission of Gonzalo Ayuso, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.