Android Studio调试smali提示:Line numbers info is not available

996.icu LICENSE

  • 问题背景
  • 解决方法
  • 总结

阅读之前注意:

本文阅读建议用时:5min
本文阅读结构如下表:

项目下属项目测试用例数量
问题背景0
解决方法1
总结0

问题背景

MacOS上用Android Studio 4.0调试逆向得到的smali代码。参考的是官方教程

or do the following in recent Android Studio 3.2:

  1. Manually disassemble an application using baksmali into a “src” subdirectory of a new project directory, e.g. baksmali d myapp.apk -o ./projects/myapp/src
  2. In Android Studio, close your current project and select “Open an existing Android Studio project”. e.g. ~/projects/myapp
  3. Once the project has been created, right click on the src directory and select “Mark Directory As->Sources Root”
  4. Make sure your app has android:debuggable=“true” in Android Manifest. Turn on “USB debugging” and use “Select debug app” to select your app in “Developer options” on Android device
  5. Start your application and forward JDWP service to localhost using adb forward tcp:8700 jdwp:$(timeout 0.5 adb jdwp | tail -n 1)
  6. In Android Studio, Create a new “Remote” debug configuration (Run->Edit Configurations), and change the debug port to 8700
  7. In Android Studio, select Run -> Debug
  8. The application should pause if/when the breakpoint is hit, at which point you can single step, add watches, etc.

其中第5步我是直接打开~/Library/Android/sdk/tools/monitor。然后在monitor中左键单击选中要调试的应用,再进行第6步。
一开始遇到了新版Android Studio(4.0)无法对smali下断点的问题,这个可以参考这篇文章解决。
没想到能下断点了,但启动调试却提示Line numbers info is not available,如下(这张图是借的别人的,我当时的断点是smali代码中的,但是这个提示是相同的):
在这里插入图片描述

解决方法

嗯,原来是没有第3步操作,即"Mark Directory As->Sources Root"。进行这步操作后就行了。
估计是这步操作对调试器声明了源码是这些。

总结

新版Android Studio调试smali,需要注意修改生效的插件。以及调试步骤要一步一步来。

如果本文对你有帮助,不如请我一罐可乐吧 🎃
在这里插入图片描述

参考资料

  1. smalidea
  2. 【Android】Line numbers info is not available in class的解决方案

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值