Git Product home page Git Product logo

androidchromedevtools's Introduction

AndroidChromeDevTools

Overview

This is a tool that allows you to use the full-featured Chrome DevTools on your Android device just like you would on a PC. This is particularly useful for web developers who want to debug and inspect web pages directly on their mobile devices.

With AndroidChromeDevTools, you can inspect elements, debug JavaScript, analyze network and performance, and much more, all directly from your Android device.

Prerequisites

  • An Android phone with Chrome installed (of course)
  • Termux installed on your phone (Install this useful tool if you haven't yet)

Setup

Open termux and run following commands to retrieve the script and install the necessary dependencies.

# Update existing packages (to avoid weird issues)
pkg up

# We need python3 and adb
apt install python android-tools -y

pip3 install websockets aiohttp

curl -o devtools.py https://raw.githubusercontent.com/lyc8503/AndroidChromeDevTools/main/devtools.py
chmod +x devtools.py

Usage

For non-rooted users

Our script uses ADB to connect to Chrome DevTools, without ROOT you will need to manually enable Wireless ADB debugging with a PC. This only needs to be done once until you reboot your phone.

You need to enable ADB debugging for your phone first and then connect it to any computer and run adb tcpip 1234 on the computer, where 1234 can be any port number you like.

Go back to the phone and start Termux, using ./devtools.py 1234 to run this script, where 1234 is the port number you just used. Until you reboot your phone, you can just run the script again without the need for a computer.

For rooted users

Using this script on a phone with ROOT access is even easier, just open Termux and run . /devtools.py (no additional arguments required).

Known issues

  • Devtools is not adapted for mobile, interaction may be somewhat difficult (requiring multiple zooms and drags), but it has full functionality.

Troubleshooting

Chrome often closes itself in the background to save memory. If a connection failure occurs, switch to Chrome, confirm that Chrome and the tab you need to debug are still running, and then try again.

If the problem still persists, please raise an issue in this repo and attach the FULL log.

androidchromedevtools's People

Contributors

lyc8503 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

androidchromedevtools's Issues

[!] Failed to forward CDP port

You mentioned: rooted devices need to run ./devtools

the script takes root access after runing ./devtools and fails to start

~ $ ./devtools.py
No port specified, setting up wireless ADB on a random port using root
Wireless ADB set up successfully on port 10983
disconnected everything
Connection refused
adb: error: no devices/emulators found
[!] Failed to forward CDP port

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.