The official version of android studio 3.6 is finally released,Come and watch,Click to view.


smali supports basic Java features such as annotations, debugging information, and line count information.It can be said that it is very close to the intermediate language compiled by java on jvm.Generally used for reverse engineering of android programs,still alright. . Xiaomingtang

Personally, I think smali is just a language implementation for disassembly,if it is possible,I can define a language like this myself,Realizing the effect of disassembly

Alright, let's look at the text.

When debugging smali in android studio was still very troublesome,Bad configuration is

error running smali:unable to open debugger port (localhost:8700):java.io.ioexception "handshake failed-connection prematurally closed

The latest version of android studio is very convenient to debug smali with additional functions. The steps are as follows:

①, apktool.jar (the latest version v2.4.1), for decompiling smali,

②, android studio (the latest version 3.6) is used for android development and debugging ide,

③, smideea-0.05.zip (the latest version 0.05), as plugin, used to breakpoints for smali, single step debugging

1. First configure the android studio development environment,This step is omitted 2. Install the smalidea plugin in android studio, first download the smalidea zip package from the official website, and then select one by one in android:

file->setting will pop up the setting dialog

Then in the settings dialog, select:plugins->Settings icon>Install plugin from disk ...

In the pop-up selection dialog,Find the downloaded smalidea archive and select ok

At this point, the plug-in installation is complete,Close android studio

3. Decompile apk with apktool

Use command:java.exe -jar apktool.jar d -f<xxxx.apk>-o<xxxx directory>

You can also directly use the apktool integration environment (if the decompilation fails, you can replace the apktool.jar to the latest version):

Add android:debuggable="true" to the decompiled androidmanifest.xml application node

Then addto the main activity invoke-static {}, landroid/os/debug;->waitfordebugger () v

Rebuild and sign apk

Install the rebuilt apk to your phone

(If repacking fails at this step,You can install the original package,Set ro.debuggable=1 of the phone root configuration/default.prop to enable global debugging.

Then start activiry with the command:adb shell am start -d -n package attribute value/android:name attribute value)

4. Import the decompiled project into android studio

By default, create project from existing sources is selected, all the way to next, and finally click finish

With the project view, right-click on the project directory->mark directory as ...->sources root

5. Expand the smali directory and select the breakpoint on the next line of the smali file where waitfordebugger code was just added.

6. Run the apk installed on the phone (the apk will suspend at the waitfordebugger code and wait for the debugger).

7. Select additional in android studio

At this point, it has been attached to the process,Can be happy to debug

to sum up

  • Previous Python statistical function library scipystats usage analysis
  • Next Python unzip, copy, delete file example code