您可以查看dexlib2 库,它是smali/baksmali项目的一部分。它提供了一个易于使用的API来访问dex文件中的信息。
示例代码:
DexFile dexFile = DexFileFactory.loadDexFile("blah.dex", 15);
for (ClassDef classDef: dexFile.getClasses()) {
for (Method method: classDef.getMethods()) {
MethodImplementation impl = method.getImplementation();
if (impl != null) {
for (Instruction instruction: impl.getInstructions()) {
// process instruction as needed...
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2227 次 |
| 最近记录: |