1. Use the -d option of apktool to decompile the apk file.
Java-jarapktool.jard-dtarget.apk-o output
2. Add android:debuggable="true "in the application node of AndroidManifest.
3. Add the following code to the onCreate of the entry point class for debugging.
invoke-static{},land roid/OS/Debug; -& gt; Waiting for debugging
4. compile apk back.
Java-jar apk tool . jar b-d output-o new target . apk
Step 5 sign apk
Java-jar sign apk . jar testkey . x509 . PEM testkey . pk8 new target . apk signed . apk
6. Install the signed apk on the mobile phone or simulator.
Adb installation signature.apk
7. Import the smali code in 1 into Android Studio.
File → Open → Output Directory → Next Breakpoint
8. Open the monitor to find the corresponding process.
Run → Monitor or Tool-> Android-& gt; Android device monitor
9. Configure remote debugging options
Run → Editor Configuration → Defaults → Remote, click+to add a new one with localhost and port 8700.
10, open apk, and click the green bug to start debugging.
Method 2: There is no need to modify the original apk file.
1, decompile apk files with tools such as Android killer.
2. Put the smali code into Android Studio and install the smaliidea plug-in.
File → Settings → Plug-ins → Install Plug-ins from Disk …→ Restart.
3. Configure remote debugging options and turn on the monitor.
4. Use adb to start apk in debugging mode.
Adb shell am start -D -n package/activity name
5. Start debugging from the breakpoint and add a register to the watch/ambiguity problem, hoping to help you.