Android is an open-source mobile operating system. You can write the operating system with the help of the simulator to meet your specific needs. The Android System is no longer valid (at least I use it). How can I implement the Android debugging program?
- Android Core Module Content Overview
- Android Browser
- Android digital certificate specific application mechanism
- Android Data Storage Access Mechanism
- Available Android APIs
The first is to use Debug to set a breakpoint for tracking, but I feel uncomfortable. I am used to using System. out, and can also use Log without System. out.
The second type is the Log I want to introduce. After reading the methods introduced by others, I tried it myself and wrote it again ~. First of all, let's briefly introduce Android. Android is actually another version of the Linux mobile platform (I am not very familiar with Android, so I think so ), since it is Linux, the command will be used. So how to run the program with commands? Run the adb command! Type "cmd" and then type "adb shell". A "#" sign is displayed. Congratulations, you can use the command to control Android.
Run "am-help" to view the help information of the "am" command, and try to run "am start-n com. google. android. browser/com. google. android. browser. browserActivity "look? Haha, you can see in the simulator that the browser is running. Haha, the Android debugging program is so simple (Simple P, it took me a long time to find this stuff ).
Also:
- // Run the browser to open chinacnet
- # Am start-a android. intent. action. VIEW-d http://www.china.com
- Am start-a android. intent. action. VIEW-d http://www.china.com
- Starting: Intent {action = android. intent. action.
VIEW data = http://www.china.com}
- // Call 123456789
- # Am start-a android. intent. action. CALL-d tel: 123456789
- Am start-a android. intent. action. CALL-d tel: 123456789
- Starting: Intent {action = android. intent. action. CALL
Data = tel: 123456789}
- # am start -a android.intent.action.ALL_APPS
- am start -a android.intent.action.ALL_APPS
- Starting: Intent { action=android.intent.action.ALL_APPS }
- // Google Map, to the shanghai dot package (Note: The dot package is a dialect, meaning a place)
- # Am start-a android. intent. action. VIEW geo: 0, 0? Q = shanghai
- Am start-a android. intent. action. VIEW geo: 0, 0? Q = shanghai
- Starting: Intent {action = android. intent. action.
VIEW data = geo: 0, 0? Q = shanghai}
Now, I will briefly introduce how to view the output statements by using commands in the Android debugging program? You can use the Log class in Android, and the Log class is in the android. util package. The Log class provides several static methods:
- Log.v(String tag, String msg);
- Log.d(String tag, String msg);
- Log.i(String tag, String msg);
- Log.w(String tag, String msg);
- Log.e(String tag, String msg);
Corresponds to Verbose, Debug, Info, Warning, and Error respectively.
A tag is an identifier and can be any string. Generally, you can use the class name + method name to provide a filter condition when viewing logs.
After the program runs, it does not output any information in the ide console. How can I view the log output? Run the "adb logcat" command:
- adb logcat
After adb logcat is executed, all log information is displayed in tail mode in real time.
At this time, we usually need to filter the information to display the information we need. At this time, the tag we specify will be used.
- adb logcat -s MyAndroid:I
Explanation: Only logs Whose tag is MyAndroid and whose level is I or higher than I (Warning, Error) are displayed.
There is also a better method. If your IDE uses Eclipse, you can select Locat in show view to view the output directly.
Now, you can implement the Android debugging program.