GitHub - APISENSE/rhino-android: Give access to RhinoScriptEngine from the JSR223 interfaces on Android JRE.

gradle

dependencies {
    implementation 'io.apisense:rhino-android:1.1.1'
}

usage

ScriptEngine engine = new ScriptEngineManager().getEngineByName("rhino");

eval() 함수 쓰려고 정의한 것

출처 : https://blog.naver.com/getinthere/221694611407

public class Eval {

    private static final String TAG = "Eval";

    public static String cal(String result){
        Log.d(TAG, "cal: 실행됨");
        ScriptEngineManager manager = new ScriptEngineManager();
        ScriptEngine engine = new RhinoScriptEngine();
        try {
            return engine.eval(result).toString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}