Android Dynamic Debug Notes

Source: Internet
Author: User

1. Modify APK profile Androidmanifest.xml
Modify the Profile <application> subkey, add the Android:debuggable= "true" property, so that the APK is in an adjustable state, packaged back.
<application android:allowbackup= "true" android:debuggable= "true" android:icon= "@drawable/ic_launcher" Android: Label= "@string/app_name" >

2. Debug boot apk (two ways)
1) Use ADB shell am (unused)
Using the format "adb shell am start-d-N Package name/package name + class name" command, you can start an activity from the console
For the specific use of this command, see ADB shell AM
2) using the phone's own debugging function (simple and convenient)
In the developer options on your phone, select the program you want to debug, and then click the program normally, and a dialog box with the title "Waiting For Debugger" pops up, prompting the user that the application is waiting for Debugger attach

3. Ida add-on app
Start android_server as root in the phone
In the main system, use the ADB forward tcp:23946 tcp:23946 command to go to the originating port data
Once you have completed these two steps, you can use Ida to attach to the application. After the attach is complete, in the Ida->debugger->debugger options, set the event breakpoint, add the library Load/unload breakpoint, so that after the app launches, every load/unload a so , will be broken, at this time, the user can go to set breakpoints, the subsequent debugging

4. Launch the App
After the three steps above, the app is ready to be debugged, and you need to start the app and let it run.
In the main system, use DDMS to view the app's debug port number (typically 8700), and then use the following command:
Jdb-connect com.sun.jdi.socketattach:hostname=localhost,port=8700
At this point, the app debugging state is lifted and starts to run normally.
But you will find that the "Waiting for Debugger" dialog box is missing, but the app is still not running because it is automatically disconnected when Ida is attached. As long as you press F9 in Ida, you can get the app to really run.

Android Dynamic Debug Notes

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.