Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the application skills of Android debugging

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the application skills of Android debugging". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the application skills of Android debugging".

In application development, we often print logs or debug debug in order to analyze some information at run time and find bug and problems easily. Android Studio's Debug function is easy to use, but sometimes it doesn't seem so fast and convenient in some cases.

such as

The point we debug is very forward when the application is opened, such as in the onCreate method of Application, so that we can't set the process to debug mode fast enough.

Although the above situation can be solved by running Android Studio's debug, it will take a long time to run if the project is very large.

So how to solve the above problem? in fact, you only need to execute one line of command.

Adb shell am set-debug-app-w com.example.jishuxiaoheiwu.appdebugsample

Among them

Set-debug-app is used to apply to debug mode

-w means wait, waiting for debugger to connect when the process starts

Com.example.jishuxiaoheiwu.appdebugsample represents the package name or ApplicationId of the application you want to debug

Execute the above command, and when we start the target application again, we will get a picture like this

Then we will have enough time to bind the process debug using Run- > Attach Debugger to Android Process. The dialog box disappears after binding, and the next startup is normal (there is no dialog box above).

So one debug doesn't necessarily solve the problem, and multiple debugging is inevitable, so do you have to execute this command every time?

The answer is yes, but there is a better way. That is,

Adb shell am set-debug-app-w-- persistent com.example.jishuxiaoheiwu.appdebugsample

The above code is different from that before, which is shown in a-persistent

-persitent means persistent, meaning that the application is always set to debug mode, that is, every time it is opened (process creation), a dialog box pops up, even if it is uninstalled and then installed or updated.

If the problem is solved after many times of debug completion, it is easy to start up again.

Adb shell am clear-debug-app

This debugging method is simple, but it may save us a lot of valuable time. I hope it can help your fellow developers.

In addition, when you encounter efficiency problems in your development, you need to think and find a faster way to work, rather than to debug the code in the onCreate method in Application, click the Android Studio debug button every time.

Thank you for your reading, the above is the content of "what are the Android debugging application skills". After the study of this article, I believe you have a deeper understanding of what the Android debugging application skills are, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report