Code Monkey home page Code Monkey logo

dex-translator's Introduction

Dex Translator

A translation library and command-line-interface tool for converting between JVM and Dalvik bytecode.

Command line tool usage

Top level:

Usage: dex-translator [-hV] [COMMAND]
See the sub-commands for available operations
  -h, --help      Show this help message and exit.
  -V, --version   Print version information and exit.
Commands:
  d2j  Convert one or more DEX files to a JAR file
  j2d  Convert one or more JAR files to an DEX file

d2j:
  Usage: d2j [-fl] [-o=<outputFile>] <inputFiles>...
  Convert one or more DEX files to a JAR file
        <inputFiles>...      Path to one or more DEX files.
    -f, --force              Flag to enable force emitting output, even if some
                               method bodies are invalid. Invalid methods will be
                               replaced with no-op behavior.
    -l, --lenient            Flag to enable options that allow more leniency in
                               the conversion process. Some input validation will
                               be skipped.
    -o, --out=<outputFile>   Path to JAR file to write to.

jd2:
  Usage: j2d [-fl] [-o=<outputFile>] <inputFiles>...
  Convert one or more JAR files to an DEX file
        <inputFiles>...      Path to one or more JAR files.
    -f, --force              Flag to enable force emitting output, even if some
                               method bodies are invalid. Invalid methods will be
                               replaced with no-op behavior.
    -l, --lenient            Flag to enable options that allow more leniency in
                               the conversion process. Some input validation will
                               be skipped.
    -o, --out=<outputFile>   Path to DEX file to write to.

Library usage

Maven dependency:

<dependency>
    <groupId>software.coley</groupId>
    <artifactId>dex-translator</artifactId>
    <version>${dexVersion}</version> <!-- See release page for latest version -->
</dependency>

Gradle dependency:

implementation group: 'software.coley', name: 'dex-translator', version: dexVersion
implementation "software.coley:dex-translator:${dexVersion}"

For most basic usage you can use the Converter and Loader types in types package. Using these looks like this:

Inputs inputs = new Inputs();
for (File inputFile : inputFiles)
	inputs.addJarArchive(inputFile.toPath());
Options options = new Options()
		.setReplaceInvalidMethodBodies(replaceInvalid)
		.setLenient(lenient)
		.setDexFileOutput(outputFile.toPath());
new Converter()
		.setInputs(inputs)
		.setOptions(options)
		.run()

For more in-depth usage you will likely want to work directly with the ApplicationData class. You can find example usage of it among the test classes.

Building

Currently, Dex Translator assumes the R8 artifact is available in the local Maven repository. In order to satisfy this assumption please clone our R8 fork and run gradlew publishToMavenLocal.

dex-translator's People

Contributors

col-e avatar xxdark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dex-translator's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.