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:
- Install Node.js
First, we need to install Node.js to prepare for using Weinre. -
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
- 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.
- 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>
- 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.
[](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:
- 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". - Turn on USB debugging
After turning on the developer options, we need to find "USB debugging" in it and turn it on. - Connect the device
Next, we need to connect the phone to the computer using a USB cable and open the Chrome browser. - Enable Chrome DevTools
Enter the following address in Chrome: chrome://inspect/#devices. Next, we will see the following page in Chrome.
[](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!

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.

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

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

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

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.

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

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

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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
A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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
Chinese version, very easy to use