-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Complete code for simple plugin can be found here: https://github.com/jadx-decompiler/jadx-example-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
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
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
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.
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 pipeline -
registerOptions
- allows plugin to add custom options, such options will be available from jadx-cli and jadx-gui -
getGuiContext
- if plugin used inside jadx-gui this method will return JadxGuiContext to customize UI