分析異常資訊,得到App版本資訊,混淆過的異常堆疊
Process: com.test.xxx PID: 17906 UID: 1000 Frozen: false Flags: 0x28c8bec5 Package: com.test.xxx v100000000 (10.0.0-20240711164441) Foreground: Yes Process-Runtime: 215118 Crash-Handler: com.android.internal.os.RuntimeInit$KillApplicationHandler Loading-Progress: 1.0 Dropped-Count: 0 ShouldUpload: true ExceptionConfig: java.lang.IllegalArgumentException: cannot use a recycled source in createBitmap at android.graphics.Bitmap.createBitmap(Bitmap.java:913) at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:835) ==================================================================================================== java.lang.IllegalArgumentException: cannot use a recycled source in createBitmap at android.graphics.Bitmap.createBitmap(Bitmap.java:913) at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:835) ...省略到業務異常 ...
版本資訊
Package: com.test.xxx v100000000 (10.0.0-20240711164441)
mapping
檔案
# compiler: R8 # compiler_version: 3.1.66 # min_api: 31 # pg_map_id: 91d205f # common_typos_disable # {"id":"com.android.tools.r8.mapping","version":"1.0"} a.a.a.a -> a.a: # {"id":"sourceFile","fileName":""} void a(long) -> b boolean a(org.xmlpull.v1.XmlPullParser) -> c void a(com.zookingsoft.expression.Expression,long) -> j a.a.a.a$a -> a.a$a: # {"id":"sourceFile","fileName":""} a.a.a.b -> a.b: # {"id":"sourceFile","fileName":""} void a(long) -> b boolean a(org.xmlpull.v1.XmlPullParser) -> c void b() -> d void c() -> e void d() -> f void e() -> g void f() -> h void g() -> i a.a.a.c -> a.c: # {"id":"sourceFile","fileName":""} void a() -> b void a(a.a.a.b) -> c java.util.ArrayList b(a.a.a.c) -> d void b() -> e java.util.ArrayList c(a.a.a.c) -> f void c() -> g a.a.a.c$a -> a.c$a: # {"id":"sourceFile","fileName":""} a.a.a.d -> a.d: # {"id":"sourceFile","fileName":""} void a(long) -> b boolean a(org.xmlpull.v1.XmlPullParser) -> c void a(com.zookingsoft.expression.Expression,com.zookingsoft.expression.Expression,long) -> j a.a.a.d$a -> a.d$a: # {"id":"sourceFile","fileName":""} a.a.a.e -> a.e: # {"id":"sourceFile","fileName":""} void a(long) -> b boolean a(org.xmlpull.v1.XmlPullParser) -> c void a(com.zookingsoft.expression.Expression,long) -> j a.a.a.e$a -> a.e$a: # {"id":"sourceFile","fileName":""} a.a.a.f -> a.f:
mapping
檔案就是一個對映表,記錄了混淆名字直接的對應關係,比如createData
名稱被混淆成aa
,所以透過這個檔案,可以把混淆後的異常堆疊反混淆還原回去。一般在打包apk釋出出去之前,都會有倉庫記錄下釋出apk的相關資訊,包括message
,mapping
,apk
等。
message
檔案
message
檔案其實就是程式碼提交記錄
TestApp code_path: revision:f438891d6432b23641f472a76aa8a412a278c237 ftp_path:/ build_number:102167 changes: f438891 #1353178 修復問題1 c5542da #1365711 修復問題2 3cbdb1f #1361482 修復問題3
由於原生代碼在不斷迭代,但是異常可能是歷史的,爲了還原異常對應的程式碼,需要回退程式碼。
透過message 檔案可以找到revision,然後回退原生代碼到該版本,
git reset --hard f438891d6432b23641f472a76aa8a412a278c237
retrace 命令反混淆異常堆疊
/Android/Sdk/tools/proguard/bin/retrace.sh -verbose ./mappings.txt ./obfuscated_stacktrace.txt > ./deobfuscated_stacktrace.txt
得到混淆之後的異常日誌
java.lang.IllegalArgumentException: cannot use a recycled source in createBitmap at android.graphics.Bitmap.createBitmap(Bitmap.java:913) at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:835) ...省略到業務異常 ...
Analyze Stack Trace
工具
把反混淆後的異常堆疊,放到工具中解析定位異常位置