I realize that this is not possible since Android doesnt have a JVM but is there a work around to this problem? I need to perform a byte code injection operation for an Android application. Any suggestions?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t directly inject bytecode into already loaded classes/methods. However, you can dynamically create new classes, write them to a dex file, and then dynamically load them
See this blog post for more information on dynamic loading of classes from a dex file on disk.
In order to dynamically create a new dex file, you might look at using the dexlib component that is part of the smali/baksmali codebase, which is a general purpose library for reading/writing dex files.
Or, alternatively, you could include smali in your application and generate your classes in the smali assembly format and use smali directly to assemble them into a new dex file.