search
HomeWeb Front-enduni-appHow to debug uniapp on Android phone

With the popularity of mobile Internet, the demand for mobile application development is increasing. But during the development process, we often need to debug on different mobile platforms. Now, in the face of this situation, Uniapp emerged as the times require. This framework allows developers to quickly develop efficient, cross-platform applications. However, because different platforms have different debugging methods, many developers are still a little confused. This article will focus on how to debug Uniapp on Android phones.

1. Use Chrome for Weinre debugging

Weinre is a tool for remote debugging on mobile devices, which can well solve the debugging problem of mobile devices during development. With Weinre, we can debug web applications on Android devices in a remote browser without having to install the application locally on the computer. The following are the specific steps:

  1. Install Node.js
    First, we need to install Node.js to prepare for using Weinre.
  2. Installing Weinre
    Before installing Weinre, we need to open a terminal or command line tool first, and then execute the following command.

    npm -g install weinre
  3. Start Weinre
    Next, we need to start Weinre. Open the command line tool and enter the following command to start the Weinre server.
weinre --httpPort 8080 --boundHost -all-

Among them, the port number can be customized. Here we specify the port number as 8080.

  1. Insert the Weinre script into the page
    Insert the following script code at the head of the page, and the IP address needs to be filled in with your local IP address.
<script></script>
  1. Connect the device
    Next, we need to open the Chrome browser on the phone and enter the following address: http://your-ip:8080/client/#anonymous . Among them, your-ip needs to fill in the local IP address just mentioned. At this point, we will see the following page in Chrome.

[How to debug uniapp on Android phone](https://img.php.cn/upload/article/000/000/068/168197743152266.png)

Click the "debug" button , you can connect to the device and perform remote debugging.

2. Use Chrome DevTools for debugging

In addition to Weinre, we can also use Chrome DevTools to debug Uniapp. The specific steps are as follows:

  1. Enable the developer options of the phone
    First, we need to find "About Phone" in the "Settings" of the Android phone and click "Version Number" seven times in a row, that is, You can turn on "Developer Options".
  2. Turn on USB debugging
    After turning on the developer options, we need to find "USB debugging" in it and turn it on.
  3. Connect the device
    Next, we need to connect the phone to the computer using a USB cable and open the Chrome browser.
  4. Enable Chrome DevTools
    Enter the following address in Chrome: chrome://inspect/#devices. Next, we will see the following page in Chrome.

[How to debug uniapp on Android phone](https://img.php.cn/upload/article/000/000/068/168197743518848.png)

Click the "inspect" button , you can open Chrome DevTools and debug the application on your phone.

Summary:

This article introduces two methods of remote debugging of Uniapp on Android phones, including using Weinre and Chrome DevTools. Both methods are very simple and easy to use and suitable for all kinds of developers. In the actual development process, we can also use these methods for debugging according to the actual situation to improve development efficiency.

The above is the detailed content of How to debug uniapp on Android phone. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do you debug issues on different platforms (e.g., mobile, web)?How do you debug issues on different platforms (e.g., mobile, web)?Mar 27, 2025 pm 05:07 PM

The article discusses debugging strategies for mobile and web platforms, highlighting tools like Android Studio, Xcode, and Chrome DevTools, and techniques for consistent results across OS and performance optimization.

What debugging tools are available for UniApp development?What debugging tools are available for UniApp development?Mar 27, 2025 pm 05:05 PM

The article discusses debugging tools and best practices for UniApp development, focusing on tools like HBuilderX, WeChat Developer Tools, and Chrome DevTools.

How do you perform end-to-end testing for UniApp applications?How do you perform end-to-end testing for UniApp applications?Mar 27, 2025 pm 05:04 PM

The article discusses end-to-end testing for UniApp applications across multiple platforms. It covers defining test scenarios, choosing tools like Appium and Cypress, setting up environments, writing and running tests, analyzing results, and integrat

What are the different types of testing that you can perform in a UniApp application?What are the different types of testing that you can perform in a UniApp application?Mar 27, 2025 pm 04:59 PM

The article discusses various testing types for UniApp applications, including unit, integration, functional, UI/UX, performance, cross-platform, and security testing. It also covers ensuring cross-platform compatibility and recommends tools like Jes

What are some common performance anti-patterns in UniApp?What are some common performance anti-patterns in UniApp?Mar 27, 2025 pm 04:58 PM

The article discusses common performance anti-patterns in UniApp development, such as excessive global data use and inefficient data binding, and offers strategies to identify and mitigate these issues for better app performance.

How can you use profiling tools to identify performance bottlenecks in UniApp?How can you use profiling tools to identify performance bottlenecks in UniApp?Mar 27, 2025 pm 04:57 PM

The article discusses using profiling tools to identify and resolve performance bottlenecks in UniApp, focusing on setup, data analysis, and optimization.

How can you optimize network requests in UniApp?How can you optimize network requests in UniApp?Mar 27, 2025 pm 04:52 PM

The article discusses strategies for optimizing network requests in UniApp, focusing on reducing latency, implementing caching, and using monitoring tools to enhance application performance.

How can you optimize images for web performance in UniApp?How can you optimize images for web performance in UniApp?Mar 27, 2025 pm 04:50 PM

The article discusses optimizing images in UniApp for better web performance through compression, responsive design, lazy loading, caching, and using WebP format.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use