After days of searching, i found that modifying an APK at Dalvik bytecode level is guaranteed to work, resulting in a new valid APK (steps explained here). I've already modified some malwares using ApkStudio which uses smali disassembler. But the question is that, is it possible to modify an APK at java bytecode level ? First convert
classes.dex to a jar file (possibly using a tool such as
.class files using a java bytecode modifier, then convert it back to dex (possibly using
dx tool) and use the resulting file to create a new APK.
There are some obfuscators that try to break java de-compilation tools by rearranging java bytecodes (explained here) (especially targeting control flow using
goto instruction in java bytecode). Is there any similar concept when converting Dalvik to java bytecodes ? In other words, is it possible to have a perfect dex to jar converting tool, independent from obfuscation techniques ? (I have used
dex2jar on some very simple APKs, but it always outputs a zip file containing errors during conversion, alongside the resulting jar file)