|
1.将以下代码复制并保存到你本地并命名为"log.smali",文件名可任意,后缀名必须为“smali”。
- .class public Lcrack;
- .super Ljava/lang/Object;
- .source "crack.java"
-
- .method public static log1(Ljava/lang/String;)V #打印出info 1字符串
- .locals 1
- .prologue
-
- const-string v0, "TAG"
- invoke-static {v0, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
- return-void
- .end method
-
- .method public static log2(Ljava/lang/String;)V #打印出info 2字符串
- .locals 1
- .prologue
-
- const-string v0, "info 2"
- invoke-static {v0, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
- return-void
- .end method
-
- .method public static log3(Ljava/lang/String;)V #打印出info 3字符串
- .locals 1
- .prologue
-
- const-string v0, "info 3"
- invoke-static {v0, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
- return-void
- .end method
-
- .method public static I(I)V #打印出int型值
- .locals 2
-
- .prologue
-
- const-string v0, "info_int"
-
- invoke-static {p0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
-
- move-result-object v1
-
- invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
-
- return-void
- .end method
-
- .method public static J(J)V #打印出long类型的值
- .locals 2
-
- .prologue
-
- const-string v0, "info_long"
-
- invoke-static {p0, p1}, Ljava/lang/String;->valueOf(J)Ljava/lang/String;
-
- move-result-object v1
-
- invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
- #黑骑士技术QQ1994091497,培训火热扩招中
- return-void
- .end method
复制代码 2.将“log.smali”加入到工程的“smali”文件的根目录下。
3.在你要打印变量的地方加上如下红框内语句,注:“V1”是你要打印的寄存器。
- invoke-static {v1}, Lcrack;->log1(Ljava/lang/String;)V #V1是你想打印得值,需要替换你想打印得寄存器
复制代码
|
-
|