xdevl / node-apk

A library to parse Android application's manifest and signature
MIT License
21 stars 5 forks source link

XML Parser Fails #7

Closed ZeeshanSultan closed 1 year ago

ZeeshanSultan commented 1 year ago

XML Parser fails to parse the application section for some apps i.e

Fails on fetching app labels because XML may be parsed incorrectly

 const resources_info = await apk.getResources();
 const label = resources_info.resolve(manifest_info.applicationLabel);
/Users/test/Desktop/apktest/node-apk/build/lib/android.js:106
            return this.xml.children.application[0].attributes.label;
                                                ^

TypeError: Cannot read properties of undefined (reading '0')
    at Manifest.get (/Users/test/Desktop/apktest/node-apk/build/lib/android.js:106:49)
    at parsed (/Users/test/Desktop/apktest/app.js:17:56)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
xdevl commented 1 year ago

Hi there, thank you for reporting the issue. Parsing seems to work fine for the second APK (https://m.apkpure.com/gta-5/com.ImpulseGaming.GTAVMobile). I can however reproduce the problem with the first one you shared, I will look into it.

xdevl commented 1 year ago

Fix for this went into 1.2.1 and has now been published on npmjs.com