I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this. And there is a demo here but I can't understand.I want to know whether dexlib2 can be used to write or rewrite the dex file
DexRewriter rewriter = new DexRewriter(new RewriterModule() {
public Rewriter<String> getTypeRewriter(Rewriters rewriters) {
return new Rewriter<String>() {
public String rewrite(String value) {
if (value.equals("Lorg/blah/MyBlah;")) {
return "Lorg/blah/YourBlah;";
}
return value;
}
};
}
});
DexFile rewrittenDexFile = rewriter.rewriteDexFile(dexFile);