DexPatcher / multidexlib2

Multi-dex extensions for dexlib2
https://dexpatcher.github.io/
GNU General Public License v3.0
68 stars 34 forks source link

How to delete class, and other #5

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hey, is there a documentation that makes it easier for me to use dexlib2? Without documentation it makes me feel very difficult.

For example, I want to delete a class in dex, and get the smali file of a class, or modify the class by bytes.

Can you help me, thank you!

Lanchon commented 5 years ago

dexlib2 in an API for manipulating dex files. it does not implement anything regarding smali. smali/baksmali are clients of dexlib2. smali and dexlib2 just happen to be published by the same developer.

I want to delete a class in dex

read the file. remove the ClassDef from the container (which typically entails creating a new container and adding all the remaining ClassDefs to it). finally write the container to a dex file.

and get the smali file of a class

you need to use baksmali code for that. baksmali might implement an API, o it might be a monolithic app, i don't know.

or modify the class by bytes.

no idea what this means.