I have tried using things on Janino on Android and have concluded that they simply do not work within the Dalvik VM.
So Im just going to ask a simple question: On Android,Is it possible to compile a string containing code during runtime for use within the app. If so, are there any libraries that let me do so and/or can you share a code example of how to do it?
For (a very simple) example, If I had a String object containing the following:
public class Adder{
int x;
int y;
public Adder(int x,int y) {
this.x = x;
this.y = y;
}
public int add() { return x+y;}
}
As one giant line of string. Is there a way I can process it to create an instance of an Adder object so I can call the add()
method, say, via the Reflection API?
Edit I've tried beanshell interpretation but it proved to be too slow. Im looking for something a little faster, just like Janino