I have the following compiled smali code inside a non-static function:
iget-object v0, p0, Lvd/b;->a:Lbz/x;
invoke-interface {v0, p1}, Lbz/x;->func(Ljava/lang/String;)Lec/b;
move-result-object p1
I want to load this part of the code dynamically, I don’t have the java source.
In Java I would use Java Runtime Compiler to get what I want, for example:
String className = "mypackage.MyClass";
String javaCode = "package mypackage;n" +
"public class MyClass implements Runnable {n" +
" public void run() {n" +
" System.out.println("Hello World");n" +
" }n" +
"}n";
Class<?> aClass = CompilerUtils.CACHED_COMPILER.loadFromJava(className, javaCode);
Runnable runner = (Runnable) aClass.newInstance();
runner.run();
How can I do the same or use different kind of solution to compiled Android code?
Thanks.