Jadx plugins guide
Jadx plugins system allows customizing decompilation process to:
- add custom rename policies
- custom code modifications (decryption, deobfuscation)
- support custom input formats (like xapk, split apk, etc)
- customize jadx-gui with additional features
Example plugin
Complete code for simple plugin can be found here: https://github.com/jadx-decompiler/jadx-example-plugin
Creating jadx plugin
Plugin main class should implement jadx.api.plugins.JadxPlugin
interface and fill some information about plugin:
import jadx.api.plugins.JadxPlugin;
import jadx.api.plugins.JadxPluginContext;
import jadx.api.plugins.JadxPluginInfo;
public class JadxExamplePlugin implements JadxPlugin {
public static final String PLUGIN_ID = "example-plugin";
@Override
public JadxPluginInfo getPluginInfo() {
return new JadxPluginInfo(PLUGIN_ID, "Jadx example plugin", "Add jadx watermark comment to every class");
}
@Override
public void init(JadxPluginContext context) {
// plugin init code
}
}
Next, to be able to auto discover plugin, you need to add resources/META-INF/services/jadx.api.plugins.JadxPlugin
file
with full name of your plugin class
Dependencies
To be able to use jadx API you need to add jadx-core
dependency:
compileOnly("io.github.skylot:jadx-core:1.5.0")
It is suggested to add it as a compile
dependency to reduce plugin size,
because at runtime jadx-core
will be used from jadx classpath
Test and install
After packing the plugin into jar, you can install it in jadx like this:
- for jadx-cli:
jadx plugins --install-jar jadx-example-plugin.jar
- for jadx-gui: in menu
Plugins
go toInstall plugin
and select you plugin jar
Publish plugin
If you want to make your plugin easy to discover, you can add it to 'jadx plugins community list': https://github.com/jadx-decompiler/jadx-plugins-list
Plugins from this list are shown in:
- jadx-cli:
jadx plugins --available
- jadx-gui: open
Preferences
go toPlugins
section, check plugins inAvailable
list
Note
Now plugins can be published only using GitHub release artifacts, check a full list of supported methods here.
Plugins API
Root of public plugins API is a JadxPluginContext
interface which available in plugin init
method.
Useful method:
addPass
- jadx pass is a common way to insert custom logic into decompilation pipelineregisterOptions
- allows plugin to add custom options, such options will be available from jadx-cli and jadx-guigetGuiContext
- if plugin used inside jadx-gui this method will return JadxGuiContext to customize UI