1

I need to load the class in the running application that if you do not recompile and reinstall and restart the entire application, and only ONE place that I develop. So i think about two ways: 1) Compile .java to .class on host, and send .class (java bytecode), which is unacceptable for dalvik VM, but java bytecode to dalvik bytecode runtime converter i don't found. 2) Send source code of class as string, and compile in runtime. But i found only dexmaker, which is mock generator, not string source compiler.

Compiling String as Code during Runtime on Android

Is there any solution?

p.s. Sorry for my English.

Update: maybe i can dynamically load classes.dex and "instancing" (i don't know is this word exist) my class?

Community
  • 1
  • 1
Jaz Brok
  • 231
  • 1
  • 4
  • 18
  • good luck with that. One other approach would be to send a script and integrate an interpretor in your app (JS (already included through webviews), python, ...) – njzk2 Jan 22 '15 at 18:36
  • Perhaps http://stackoverflow.com/questions/6857807/ ? – fadden Jan 22 '15 at 18:40
  • The "dx" tool from the android sdk is the tool you can use to convert java bytecode to dalvik bytecode. – JesusFreke Jan 22 '15 at 20:45

1 Answers1

2

You can use DexClassLoader to load a classes.dex file. This question might help you as well.

Community
  • 1
  • 1
Andrey Breslav
  • 24,795
  • 10
  • 66
  • 61