Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed Groovy in an Android Java App

Basically, I need to run Groovy Scripts to manipulate Java objects, and GroovyShell / GroovyScriptEngine seems to be the best way to do so. Is it possible to embed Groovy inside a Java App? I tried placing the groovy-all-1.8.2.jar into my Android Java App's libs folder, referenced it then hit compile but I got a bunch of errors.

How do I do this?

like image 575
GaiusSensei Avatar asked Sep 27 '11 09:09

GaiusSensei


3 Answers

I don't believe this will work. Groovy converts scripts to bytecode, and as the Dalvik bytecode is different to the Java bytecode that Groovy expects, I believe it will have problems...

The Discobot from a few years ago has been resurrected though, and great progress is being made so there is hope on the horizon.

But that doesn't help you today...

like image 197
tim_yates Avatar answered Oct 16 '22 19:10

tim_yates


In near future it will be possible: http://skillsmatter.com/podcast/home/groovy-android/

like image 2
amra Avatar answered Oct 16 '22 21:10

amra


I have found it recelty. You can find the solution from http://melix.github.io/blog/2014/06/grooid.html.

Check it http://glaforge.appspot.com/article/groovy-2-3-3-and-groovy-2-4-beta-1-with-android-support too!

like image 2
See young Avatar answered Oct 16 '22 21:10

See young