Multi-dex extensions for dexlib2

oSumAtrIX 6db4dc4c95 build: Use Maven Central instead of JCenter il y a 1 an
.idea fb02b58c45 Update IDE files il y a 5 ans
gradle ac410e52eb build: move to smali fork by Google il y a 1 an
src 9833e732a0 feat: Use `FileDataStore` instead of `MemoryDataStore` il y a 1 an
.gitignore 129555089a Update IDEA il y a 6 ans
.travis.yml 6110281518 Clean builds on travis il y a 5 ans
LICENSE.txt cfdde9f1e8 Fork multidexlib2 from its DexPatcher-tool subproject to a separate repo il y a 7 ans
NOTICE.txt f5cad9d2d4 Update copyright il y a 5 ans
README.md b8c145ec66 Update README.md il y a 7 ans
README.txt 54afec054d Move 'README.txt' file il y a 5 ans
build.gradle 6db4dc4c95 build: Use Maven Central instead of JCenter il y a 1 an
check-copyright.gradle 4fe6ead964 Cosmetic il y a 5 ans
configure-artifacts.gradle f5cad9d2d4 Update copyright il y a 5 ans
configure-publishing.gradle be7dd1259a build: Remove publication repository il y a 1 an
gradlew 63d7b4f5d6 Bump Gradle version to 6.0 il y a 5 ans
gradlew.bat 63d7b4f5d6 Bump Gradle version to 6.0 il y a 5 ans

README.md

multidexlib2

Multi-dex extensions for dexlib2.

Maven Central Build Status

This is a free software (GPLv3+) library on top of dexlib2 that features:

  • Multi-dex reading and writing.
  • Optional management of the content of the main dex file when writing multi-dex.
  • Simplified read/write access to multi-dex containers as plain-old dexlib2 DexFile objects, making it trivial to add multi-dex support to existing non-multi-dex-aware dexlib2 clients.
  • Faster dex reads than plain dexlib2.
  • Optional multi-threaded multi-dex writes that deliver greatly increased write performance.
  • Automatic management of dex version, dex opcodes, and API level.
  • Configurable naming of multi-dex member files.
  • Progress logging to a client-provided logger.

Limitations:

  • Only supports dex files. (Does not support odex/oat files.)
  • Only writes dex files to directories. (Does not write into zip files.)

DISTRIBUTION

Releases of multidexlib2 are distributed with coordinates com.github.lanchon.dexpatcher:multidexlib2 through the Maven Central Repository, with version numbers starting at 2.2.0 and matching the version of dexlib2 they were built against. Release changelog is available here.

USAGE

Interface:

  • MultiDexIO: read and write potentially multi-dex containers.
    • readDexFile(): read potentially multi-dex container and return a single, merged DexFile.
    • readMultiDexContainer(): read potentially multi-dex container and return a MultiDexContainer.
    • writeDexFile(): write potentially multi-dex container from a single DexFile.
  • RawDexIO: read and write single dex files (supersedes invoking dexlib2 directly).

Parameters:

  • boolean multiDex: true to enable multi-dex support.
  • File file: file or directory to read or write.
  • DexFileNamer namer: set to new BasicDexFileNamer().
  • Opcodes opcodes: null to auto-detect.
  • int maxDexPoolSize: set to DexIO.DEFAULT_MAX_DEX_POOL_SIZE.
  • int threadCount: thread count for multi-threaded multi-dex writes.
    • 1 to force single-threaded writes.
    • 0 to auto-detect optimum thread count.
  • int minMainDexClassCount, boolean minimalMainDex: main dex file content management.
    • 0, false to disable main dex management.
  • DexIO.Logger logger: null to disable logging.

Sample:

DexPatcher's file processor is a simple yet production-quality client of multidexlib2.