Skip to content
/ ApkInfo Public

Parse the AndroidManifest.xml and resources.arsc file in the apk file.

Notifications You must be signed in to change notification settings

frazy/ApkInfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#ApkInfo

Parse the AndroidManifest.xml and resources.arsc file in the apk file (apk already has zipjs unpacked).

参考文档:

[1]AndroidManifest文件格式 - https://blog.csdn.net/jiangwei0910410003/article/details/50568487

[2]Resource.arsc文件格式 - https://blog.csdn.net/jiangwei0910410003/article/details/50628894

eg:

import JSZip from 'jszip';
import ApkInfo from 'js-apk-parser';

JSZip.loadAsync(file)
  .then(zip => {
    zip.file("AndroidManifest.xml").async("arraybuffer").then(buffer => {
      JSZip.loadAsync(file).then(zip2 => {
        zip2.file("resources.arsc").async("arraybuffer").then(buffer2 => {
          const apkInfo = new ApkInfo(buffer, buffer2);
          console.log(`解析成功!包名:${apkInfo.getPackage()},version:${apkInfo.getVersionName()}, label: ${apkInfo.getLabel()}`);
        });
      });
    });
  }, e => {
  console.log(`解析apk失败:${e.message}`);
});

由于jszip^3.1.5版本存在bug,see:

Stuk/jszip#543

fork了一份代码,修改后publish到了npm,所以请:

npm install jszip-issue-543 --save
import JSZip from 'jszip-issue-543';

About

Parse the AndroidManifest.xml and resources.arsc file in the apk file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published