androidruntime-compilationdexmaker

Compiling Java code under Android in runtime


I have a class name String and a String which containing the class code. For example, "Example" is the name of the class, and

public class Example {
    public void example () {System.out.println ("Hello world!"); }
}

The class code.

I looked at the Dexmaker library, but I did not understand if it's possible to compile the generated code into it. And the question is just how to compile the code string under Android?


Solution

  • There is only one true way: using DexMaker. All examples you can find on DexMaker wiki and especially for current problem (runtime generation code on android).