apk-parser

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Лицензия

Лицензия

The BSD 2-Clause License
Категории

Категории

Сеть
Группа

Группа

net.dongliu
Идентификатор

Идентификатор

apk-parser
Последняя версия

Последняя версия

2.6.10
Дата

Дата

Тип

Тип

jar
Описание

Описание

apk-parser
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Ссылка на сайт

Ссылка на сайт

https://github.com/hsiafan/apk-parser
Система контроля версий

Система контроля версий

https://github.com/hsiafan/apk-parser

Скачать apk-parser

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.dongliu/apk-parser/ -->
<dependency>
    <groupId>net.dongliu</groupId>
    <artifactId>apk-parser</artifactId>
    <version>2.6.10</version>
</dependency>
// https://jarcasting.com/artifacts/net.dongliu/apk-parser/
implementation 'net.dongliu:apk-parser:2.6.10'
// https://jarcasting.com/artifacts/net.dongliu/apk-parser/
implementation ("net.dongliu:apk-parser:2.6.10")
'net.dongliu:apk-parser:jar:2.6.10'
<dependency org="net.dongliu" name="apk-parser" rev="2.6.10">
  <artifact name="apk-parser" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.dongliu', module='apk-parser', version='2.6.10')
)
libraryDependencies += "net.dongliu" % "apk-parser" % "2.6.10"
[net.dongliu/apk-parser "2.6.10"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.google.code.findbugs : jsr305 Необязательный jar 3.0.0
org.bouncycastle : bcprov-jdk15on Необязательный jar 1.58
org.bouncycastle : bcpkix-jdk15on Необязательный jar 1.58

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

APK parser lib, for decoding binary XML files, getting APK meta info.

Table of Contents

Features

  • Retrieve APK meta info, such as title, icon, package name, version, etc.
  • Parse and convert binary XML files to text
  • Get classes from DEX files
  • Get APK singer info

Get APK-parser

Get APK-parser from the Maven Central Reposotiry:

<dependency>
    <groupId>net.dongliu</groupId>
    <artifactId>apk-parser</artifactId>
    <version>2.6.10</version>
</dependency>

From version 2.0, apk-parser requires Java 7. The last version to support Java 6 is 1.7.4.

Usage

The ordinary way is using the ApkFile class, which contains convenient methods to get AndroidManifest.xml, APK info, etc. The ApkFile need to be closed when no longer used. There is also a ByteArrayApkFile class for reading APK files from byte array.

1. APK Info

ApkMeta contains name(label), packageName, version, SDK, used features, etc.

try (ApkFile apkFile = new ApkFile(new File(filePath))) {
    ApkMeta apkMeta = apkFile.getApkMeta();
    System.out.println(apkMeta.getLabel());
    System.out.println(apkMeta.getPackageName());
    System.out.println(apkMeta.getVersionCode());
    for (UseFeature feature : apkMeta.getUsesFeatures()) {
        System.out.println(feature.getName());
    }
}
2. Get Binary XML and Manifest XML Files
try (ApkFile apkFile = new ApkFile(new File(filePath))) {
    String manifestXml = apkFile.getManifestXml();
    String xml = apkFile.transBinaryXml("res/menu/main.xml");
}
3. Get DEX Classes
try(ApkFile apkFile = new ApkFile(new File(filePath))) {
    DexClass[] classes = apkFile.getDexClasses();
    for (DexClass dexClass : classes) {
        System.out.println(dexClass);
    }
}
4. Get APK Signing Info

Get the APK signer certificate info and other messages, using:

try(ApkFile apkFile = new ApkFile(new File(filePath))) {
    List<ApkSigner> signers = apkFile.getApkSingers(); // apk v1 signers
    List<ApkV2Signer> v2signers = apkFile.getApkV2Singers(); // apk v2 signers
}
5. Locales

An APK may have different info (title, icon, etc.) for different regions and languages——or we can call it a "locale". If a locale is not set, the default "en_US" locale (Locale.US) is used. You can set a preferred locale by:

try (ApkFile apkFile = new ApkFile(new File(filePath))) {
    apkFile.setPreferredLocale(Locale.SIMPLIFIED_CHINESE);
    ApkMeta apkMeta = apkFile.getApkMeta();
}

APK-parser will find the best matching languages for the locale you specified.

If locale is set to null, ApkFile will not translate the resource tag, and instead just give the resource ID. For example, the title will be something like '@string/app_name' instead of the real name.

Reporting Issues

If this parser has any problem with a specific APK, open a new issue, with a link to download the APK file.

Версии библиотеки

Версия
2.6.10
2.6.9
2.6.8
2.6.7
2.6.6
2.6.5
2.6.4
2.6.3
2.6.2
2.6.1
2.6.0
2.5.3
2.5.2
2.5.1
2.5.0
2.4.2
2.4.1
2.4.0
2.3.0
2.2.1
2.2.0
2.1.7
2.1.6
2.1.5
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.15
2.0.14
2.0.13
2.0.12
2.0.11
2.0.10
2.0.9
2.0.7
2.0.6
2.0.5
2.0.3
2.0.2
2.0.1
2.0.0
1.7.5
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.1
1.6.0
1.5.0
1.4.8
1.4.7
1.4.6
1.4.5
1.4.3
1.4.2