Problems using Rhino on Android

后端 未结 3 1357
清酒与你
清酒与你 2020-12-05 14:54

I\'m trying to use Mozilla Rhino in my Java application for Android to evaluate some JavaScript. I am using Eclipse + ADT plugin.

First I tried simply downloading th

相关标签:
3条回答
  • 2020-12-05 15:17

    An Android-compatible edition of rhino1_7R2.jar is available on the SL4A site, in the version control system. Here is a sample project that wraps up Rhino and BeanShell into an Android interpreter service.

    0 讨论(0)
  • 2020-12-05 15:20

    I finally got it to work. I should have paid more close attention to that blog post I linked.

    If I add the line

    cx.setOptimizationLevel(-1);
    

    to disable optimisations, everything works perfectly.

    0 讨论(0)
  • 2020-12-05 15:30

    I've written a library which allows to run Rhino on Android.

    Advantages include:

    • Rhino can only run on optimization level -1. The library supports all levels.
    • The library supports the use of JavaAdapter, which is not possible with base Rhino.
    • Altough i did not benchmark this, it should give a performance increase. (Compiled code is faster than interpreted code)

    https://github.com/F43nd1r/rhino-android

    0 讨论(0)
提交回复
热议问题