Smalidea + IntelliJ IDEA/Android Studio dynamic debugging Android app tutorial

Source: Internet
Author: User

Smalidea + IntelliJ IDEA/Android Studio dynamic debugging Android app tutorial
Smalidea

Smalidea is an IntelliJ IDEA/Android Studio smali language plug-in that enables dynamic debugging of smali code.

Github address:https://github.com/JesusFreke/smali/wiki/smalidea

:https://bitbucket.org/JesusFreke/smali/downloads

Dynamic debugging of Android apps

Smalidea supports IDEA of version 14.1 or later. Android Studio is also supported if it is based on IDEA of version 14.1 or later. Here I use Android Studio of Version 2.0, and the IDEA operation is similar.

Download the three files from the preceding address.

Install smalidea

1. Open Android Studio, press Alt + Ctrl + S to open the setting interface, and click Plugins -- Install plugin from disk... --Select the downloaded smalidea-0.03.zip file.
2. Restart Android Studio.

Baksmali

Use baksmali to decompile the apk to get the smali code.

Run the following command to obtain the smali code of the apk, in the./projects/myapp/src directory.
Java-jar baksmali-2.1.2.jar myapp.apk-o./projects/myapp/src

Create a new project and import smali

1. Project from Existing Sources...

Select project directory

Next...

2. After the project is successfully created, right-click the src Directory and choose "Mark Directory As -- Sources Root ".

Start app debugging

1. Open DDMS
After the project is successfully created, you cannot click the Android Device Monitor button because it is not a complete Android project. However, you can click monitor. bat in the Android SDK/tools directory to open DDMS.

2. Run/Debug deployments
Create a "Remote" debug configuration (Run-> Edit Configurations) and set PZ Configurations? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcnTOqjg3MDChoyA8YnI + cjxpbwcgc3jjjpq =" http://www.2cto.com/uploadfile/Collfiles/20160414/20160414091049577.png "alt =" here write picture description "title =" \ ">

3. Place a breakpoint where you need it in the smali code.

4. Run the application and select the process of the application in DDMS.

5. Click Debug to start debugging. When a breakpoint is reached, the application is paused, and you can perform the same operations as debugging the application.

Note: All local variables in smali start with v. locals n at the top of the method indicates that this method uses n local variables. All parameters start with p, and local variables and parameters start with 0. For non-static methods, p0 is the reference of the object itself, that is, the this pointer.

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.