Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/apk.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const Zip = require('./zip')
const { mapInfoResource, findApkIconPath, getBase64FromBuffer } = require('./utils')
const ManifestName = /^androidmanifest\.xml$/
const ResourceName = /^resources\.arsc$/
const X86 = /^lib[\\/].*-v7a[\\/]/;
const X64 = /^lib[\\/].*-v8a[\\/]/;

const ManifestXmlParser = require('./xml-parser/manifest')
const ResourceFinder = require('./resource-finder')
Expand All @@ -19,7 +21,7 @@ class ApkParser extends Zip {
}
parse () {
return new Promise((resolve, reject) => {
this.getEntries([ManifestName, ResourceName]).then(buffers => {
this.getEntries([ManifestName, ResourceName, X86, X64]).then(buffers => {
if (!buffers[ManifestName]) {
throw new Error('AndroidManifest.xml can\'t be found.')
}
Expand All @@ -33,11 +35,15 @@ class ApkParser extends Zip {
// update apkInfo with resourceMap
apkInfo = mapInfoResource(apkInfo, resourceMap)

if (buffers[X86]) apkInfo['x86'] = 1;
if (buffers[X64]) apkInfo['x64'] = 1;

// find icon path and parse icon
const iconPath = findApkIconPath(apkInfo)
if (iconPath) {
this.getEntry(iconPath).then(iconBuffer => {
apkInfo.icon = iconBuffer ? getBase64FromBuffer(iconBuffer) : null
apkInfo.iconBuffer = iconBuffer ?? null;
resolve(apkInfo)
}).catch(e => {
apkInfo.icon = null
Expand Down