tim_xyz
tim_xyz

Reputation: 13481

Is it possible to open developer tools console in Chrome on Android phone?

An AngularJS application works fine on desktop, but is not rendering properly on mobile (actual code is showing). This is on an Android phone.

I would like to see what errors are showing in the console.

Is it possible to open JS console on chrome app on mobile (like it is on desktop)?

Upvotes: 507

Views: 1007836

Answers (11)

veet
veet

Reputation: 53

It is possible to do on-device debug for any site

Injecting Eruda into the page you are currently visiting or import it as a dev dependency onto your project. You can also demo it here. Make sure you read the github documentation.

For inject it you can paste the code below into your search bar, and because browsers remove the javascript: when you paste it, be sure to reintroduce it. And more importantly, be aware that you are directly running a piece of javascript that source externally hosted code. Make sure you trust the author and have reviewed the code it depends on.

javascript:(function () { var script = document.createElement('script'); script.src="https://cdn.jsdelivr.net/npm/eruda"; document.body.append(script); script.onload = function () { eruda.init(); } })();

For security reasons some browsers have disable running javascript from the search bar.

Upvotes: 2

Daniel Lemke
Daniel Lemke

Reputation: 2449

The originally accepted answer doesn't seem to be valid anymore. From the current Chrome developer docs, these are the basic steps you need to go through:

  1. Open the Developer Options screen on your Android. See Configure On-Device Developer Options.
  2. Select Enable USB Debugging.
  3. On your development machine, open Chrome.
  4. Go to chrome://inspect#devices.
  5. Make sure that the Discover USB devices checkbox is enabled.

After that, open Chrome on your Android device (and confirm the USB Debugging prompt in case it pops up). Switch back to your PC and you should see the currently open browser tabs:

enter image description here

If your device tabs do not appear, you might need to trigger the USB Debugging prompt by activating file transfer on your mobile device.

Upvotes: 83

PseudoAj
PseudoAj

Reputation: 5941

You can do it using remote debugging. Here is official documentation. Basic process:

  1. Connect your Android device
  2. Select your device: More tools > Inspect devices* from dev tools on pc/Mac.
  3. Authorize on your mobile.
  4. Happy debugging!!

* This is now "Remote devices".

Upvotes: 382

fatemeh sadeghi
fatemeh sadeghi

Reputation: 2573

To use remote debugging first activate developer mode in Android.

  1. In Android go to Settings, search build number, then click on it several times to activate developer mode
  2. In Android go to Settings > Developer Options > Enable usb debugging
  3. Connect to computer with usb cable
  4. In desktop Chrome type chrome://inspect , then press enter
  5. In mobile open url then check it, on this page on desktop chrome://inspect/#devices

Upvotes: 180

Pawel
Pawel

Reputation: 18212

Kiwi Browser is mobile Chromium and allows installing extensions. Install Kiwi and then install "Mini JS console" Chrome extension(just search in Google and install from Chrome extensions website, uBlock also works ;). It will become available in Kiwi menu at the bottom and will show the console output for the current page.

Edit 2022: It's even better now. The console is built-in and available in the menu.

Upvotes: 57

KhalfaniW
KhalfaniW

Reputation: 672

The Kiwi browser not only allows you to use Chrome dev tools but you can also view the page at the same time.

If you use Android split screen you can open a window and move the dev tools to a new window.

example inspect element

Upvotes: 17

BlackHammer
BlackHammer

Reputation: 91

Use Kiwi Browser app

Allows you to install all chrome extensions as well as access dev tools (console, ...)

Or

to access and test all the consoles of different mobile browsers, you can use the following similar websites:

https://www.browserstack.com/

Upvotes: 10

zahra_oveyedzade
zahra_oveyedzade

Reputation: 1210

Remotely debugging Firefox is another option. the steps are mentioned here

Upvotes: 2

Sensei James
Sensei James

Reputation: 2695

Please do yourself a favor and just hit the easy button:

download Web Inspector (Open Source) from the Play store.

A CAVEAT: ATTOW, console output does not accept rest params! I.e. if you have something like this:

console.log('one', 'two', 'three');

you will only see

one

logged to the console. You'll need to manually wrap the params in an Array and join, like so:

console.log([ 'one', 'two', 'three' ].join(' '));

to see the expected output.

But the app is open source! A patch may be imminent! The patcher could even be you!

Upvotes: 22

trogper
trogper

Reputation: 1674

When you don't have a PC on hand, you could use Eruda, which is devtools for mobile browsers https://github.com/liriliri/eruda
It is provided as embeddable javascript and also a bookmarklet (pasting bookmarklet in chrome removes the javascript: prefix, so you have to type it yourself)

Upvotes: 140

John Balvin Arias
John Balvin Arias

Reputation: 2886

I you only want to see what was printed in the console you could simple add the "printed" part somewhere in your HTML so it will appear in on the webpage. You could do it for yourself, but there is a javascript file that does this for you. You can read about it here:

http://www.hnldesign.nl/work/code/mobileconsole-javascript-console-for-mobile-devices/

The code is available from Github; you can download it and paste it into a javascipt file and add it in to your HTML

Upvotes: 14

Related Questions