Android Studio Debugging features use summary "Go"

Source: Internet
Author: User

This period of time has been using IntelliJ idea, today, the use of debugging area tools recorded here.

Compile the program you want to debug first.

1. Set breakpoints

Select the line of code where you want to set the breakpoint, and click the left mouse button after the area of the row number.

2. Turn on the debug session

Click on the red arrow pointing to the Bug and start debugging.

The debug view appears below the IDE, and the red Arrow points to the line of code that is now stuck in the debugger, in method F2 (), line 11th of the program. The red arrow hovers over the area of the program's method call stack. In this area shows the method used by the program to execute to the breakpoint, the more the following method is called earlier.

3. Single Step commissioning 3.1 step Over

Click on the button pointing to the red Arrow, the program executes a line down (if the current line has a method call, this method will be executed to return, and then to the next line)

3.2 Step Into

Click the button pointing to the red Arrow and the program executes one line down. If the row has a custom method, it runs into a custom method (a method that does not enter the official class library). The steps are as follows:

Set breakpoints at Custom method send F1 (), perform debugging

Click

3.3 Force Step Into

This button can enter any method when debugging.

3.4 Step Out

If you enter a method (such as F2 ()) while debugging, and feel that the method is not a problem, you can use StepOut to jump out of the method and return to the next line of statements where the method is being used. It is worth noting that the method has been executed.

3.5 Drop Frame

When you click the button, you will return to the current method's call (for example, the program will return to Main ()) and the value of all context variables will return to that time. You can jump to any of these methods as long as there is a parent method in the call chain.

4. Advanced Debugging 4.1 cross-Breakpoint debugging

Set multiple breakpoints to turn on debugging.

To move to the next breakpoint, click for example:

The program runs a breakpoint to the next breakpoint between the code that needs to be executed. If the following code does not have a breakpoint, tapping the button again will run the program.

4.2 Viewing breakpoints

Click the arrow Point button to view the breakpoints you have set and to set some properties of the breakpoint.

Arrow 1 points to the breakpoint you have set, and arrow 2 can set a conditional breakpoint (when a condition is met, pause the execution of the program, such as C==97). After you finish debugging, you should delete the breakpoint you set at arrow 1 (after selecting the breakpoint you want to delete, click the red minus sign above).

4.3 Setting variable values

After debugging starts, the red arrow points to the area can assign a value to the specified variable (left mouse button to select the variable, right-click Pop-up menu select SetValue ... )。 This feature allows you to detect your conditional statements and loop statements more quickly.

alt+f8 debug时选中查看值 f8相当于eclipse的f6跳到下一步 shift+f8相当于eclipse的f8跳到下一个断点,也相当于eclipse的f7跳出函数 f7相当于eclipse的f5就是进入到代码 alt+shift+f7这个是强制进入代码 ctrl+shift+f9 debug运行java类 ctrl+shift+f10正常运行java类 command+f2停止运行

Android Studio Debugging features use summary "Go"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.