How to execute JavaScript on Android?

后端 未结 10 1424
迷失自我
迷失自我 2020-11-27 14:38

I have code which uses ScriptEngineManager, ScriptEngine class for executing JavaScript code using Java. But it works fine in Java SE, and doesn\'t work in Android - SDK sh

10条回答
  •  爱一瞬间的悲伤
    2020-11-27 14:48

    I just found the App JavaScript for Android, which is the Rhino JavaScript engine for Java. It can use all Java-classes, so it has BIG potential. The problem is it might be slow, since it is not really optimized (heavy CPU load). There is another JavaScript engine named Nashorn, but that unfortunately doesn't works on Google's DalvikVM Java engine (does not support the optimizations of Oracle Java engine). I hope Google keeps up with that, I would just love it!

提交回复
热议问题