Giter VIP home page Giter VIP logo

android-connect's Introduction

Android Connect Script

This script connects to an Android device via ADB (Android Debug Bridge) and then mirrors the device screen using scrcpy. It allows the user to specify the device IP and port through an android-connect.yml file or via user input.

Prerequisites

Ensure that the following dependencies are installed on your system:

  • adb
  • scrcpy
  • yq (for parsing YAML files)

You can install these dependencies using the package manager of your choice. For example, on Debian-based systems:

sudo apt-get update
sudo apt-get install adb scrcpy yq

Installation

Automatical installation

  1. Clone the repository using the following command:
git clone https://github.com/satrujit11/android-connect.git
  1. Move to the cloned directory:
cd android-connect
  1. Run the script using the following command:
./setup.sh

Manual installation

  1. Clone the repository using the following command:
git clone https://github.com/satrujit11/android-connect.git
  1. Move the script to /usr/local/bin:
sudo mv android-connect/android-connect.sh /usr/local/bin/android_connect
  1. Make the script executable:
sudo chmod +x /usr/local/bin/android_connect
  1. Run the script using the following command:
android_connect

Usage

Specifying Device IP and Port

If android_connect.yml is present in the current directory, the script will read the IP and port from this file. If the values are not specified in the file, it will use default values (192.168.29.137 for IP and 5555 for port).

If android_connect.yml is not present, the script will prompt you to enter the device IP and port. You can press Enter to use the default values.

Example android_connect.yml

device_ip: 192.168.1.10
device_port: 5555

Script Workflow

  1. Save the current directory: The script saves the directory where it was initially run.

  2. Check for configuration file: It checks if android_connect.yml exists and reads the device IP and port from it.

  3. Prompt for input: If the configuration file does not exist, it prompts the user to enter the device IP and port.

  4. Navigate to platform-tools directory: Changes the directory to ~/Android/Sdk/platform-tools.

  5. Connect to the Android device:

    • Connects to the device using the specified IP and port.
    • Sets the device to use TCPIP mode on port 5555.
    • Reconnects to the device.
  6. Return to the initial directory: Changes back to the original directory.

  7. Run scrcpy: Mirrors the Android device screen using scrcpy.

Troubleshooting

  • Ensure ADB is configured correctly: Make sure adb is installed and added to your system PATH.

  • Check device connection: Ensure your Android device is on the same network and the IP address is correct.

  • Verify dependencies: Make sure all dependencies (adb, scrcpy, yq) are installed and up to date.

License

This script is licensed under the MIT License. Feel free to use and modify it as per your needs.

android-connect's People

Contributors

satrujit11 avatar

Watchers

 avatar

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.