Earlence
Earlence

Reputation: 71

bytecode injection on dalvik

I have asked this on android platform, but did not receive a reply. I have referred to this thread, but could not find what post he was referring to (Dynamically Generating Dalvik Bytecode into a running Dalvik/Android application)

Also, This issue was raised(http://code.google.com/p/android/issues/detail?id=6322)

So, my question is,

  1. has there been any progress in this regard?
  2. Is it possible to inject new bytecode into a class that is being loaded?
  3. if so, any pointers to the same?

Cheers. Earlence

Upvotes: 7

Views: 2516

Answers (2)

Gabriele
Gabriele

Reputation: 1

You can also check tools like redexer (http://www.cs.umd.edu/projects/PL/redexer/) and smali (https://code.google.com/p/smali/)

Upvotes: 0

Jesse Wilson
Jesse Wilson

Reputation: 40595

Android's Dalvik team is intending to create an API that generates dex files at runtime, but we have nothing to show at the moment.

Your best bet today is to use a Java bytecode injection framework (ASM, cglib, etc.) and to include dx.jar (that is, the guts of the dx tool) in your program to convert generated .class files into a .dex file at runtime. If that (hacky) strategy isn't sufficient, you're on your own. This problem is a good opportunity for open source!

Upvotes: 2

Related Questions