Android Studio debugging method learning notes, android learning notes

Source: Internet
Author: User

Android Studio debugging method learning notes, android learning notes
(Note: The Keymap of my Android Studio has been set to Eclipse copy.) 1. You can only set the breakpoint to locate the debugging location. Otherwise, the debugging location cannot be found. (Breakpoint can also be added during debugging) 2. Select the program to be debugged in debugging mode and enter debugging mode. :3. Single-step debugging(1) step over: F6

The debugger command step-over (next in GDB) is used to move to the next executable code line in the same call stack layer. If the current row is a function call, the debugger stops the next statement after the function call. The debugger does not enter the function body. If the current row is the last row of the function, step-over enters the next stack layer and stops the next row when the function is called.
(2) step into: Enter F5
The debugger command step-into (step in GDB) is used to move to the next executable code line. If the current row is a function call, the debugger enters the function and stops the first row in the function body. Step-into helps uncover the mysteries of the code location. For example, function calls and functions may be stored in different files.
(3) Force step into: shortcut: Alt + Shift + F7 This button can be used in any way during debugging. (4) step out: shortcut F7 The debugger command step-out (finish in GDB) is used to forward to the next layer in the stack and stop the next line of the called function. (5) Drop frame: Position
After you click this button, you will return to the call of the current method (for example, the program will return to main () for re-execution, and the value of all context variables will return to that time. As long as there is a higher-level method in the call chain, you can jump to any of the methods.

4. Advanced debugging
(1) Cross-breakpoint debugging (Resume Program: shortcut key F8)
Set multiple breakpoints to enable debugging.
To move to the next breakpoint, press F8 (or press the button shown by the arrow ).

The program runs the code that needs to be executed between a breakpoint and the next breakpoint. If there is no breakpoint in the subsequent code, click this button again to execute the program.

(2) view breakpoints
Click the arrow to view the breakpoint and set its attributes.
You can set the breakpoint condition at the arrow (when a certain condition is met, the execution of the program is paused ). After debugging, delete the breakpoint set at Arrow 1 (select the breakpoint to be deleted and click the red minus sign on the top ). (3) set the variable valueAfter Debugging starts, you can assign a value to the specified variable in the area pointed to by the Red Arrow (select the variable with the left mouse button and select setValue from the context menu ...). This function can quickly detect your condition statements and loop statements. 5. Exit debugging: press Ctrl + F2Click the arrow to stop debugging.

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.