AndroidDeveloperLB/apk-parser

Bug: unable to get app version code for some rare cases

AndroidDeveloperLB opened this issue · 2 comments

This is what I get from the sample on Vivo V23:

apk version code is different for "com.android.mms.service" on /system/priv-app/MmsService_T1/MmsService_T1.apk : correct one is: 0 vs found: null isSystemApp?true apk version code is different for "com.vivo.entitlement" on /system/app/Entitlement/Entitlement.apk : correct one is: 0 vs found: null isSystemApp?true apk version code is different for "com.vivo.omacp" on /system/priv-app/Omacp/Omacp.apk : correct one is: 0 vs found: null isSystemApp?true apk version code is different for "com.android.systemui" on /system/priv-app/SystemUI/SystemUI.apk : correct one is: 0 vs found: null isSystemApp?true

APKs:

apks.zip

For SystemUI.apk, it became quite large, so I had to split it. Rename "SystemUI.zip" to "SystemUI.zip.001" and "SystemUI2.zip" to "SystemUI.zip.002", and "SystemUI3.zip" to "SystemUI.zip.003" :
SystemUI.zip
SystemUI2.zip
SystemUI3.zip

Checking on an online decompiler (here: http://www.javadecompilers.com/ ), I think the "android:versionCode" is just missing, which means it should probably be treated as the default one: 0.

Fixed by adding a check for it being null or not, and having a default value for it.