在下面的示例代码中,如何添加命令以将v0,v1等的值打印到logcat?

const v1, 0x7f05002e

iget-object v2, p0, Lcom/company/myapp/MainActivity;->d:Lcom/company/myapp/f;

invoke-virtual {v2}, Lcom/company/myapp/f;->getPanelModel()Lcom/company/myapp/h;

move-result-object v2

invoke-virtual {v2}, Lcom/company/myapp/h;->b()I

move-result v2

invoke-virtual {v0, v1, v2}, Lcom/company/e/k;->a(II)V

iget-object v0, p0, Lcom/company/myapp/MainActivity;->c:Lcom/company/e/k;

最佳答案

在末尾添加:

const-string v8, "log-tag"

invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v9

invoke-static {v8, v9}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

根据您的示例v1是整数,因此在使用log之前,函数String;->valueOf(I)用于将其转换为String。还在调试日志级别输出Log;->d;可能需要另一个级别。

09-11 03:06