1. 参考Reference javax.script.ScriptEngine in android or evaluate a javascript expression

  2. 运用库:Rhino:Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users. It is embedded in J2SE 6 as the default Java scripting engine.

    1. compile 'org.mozilla🦏1.7R4'
    1
    2
    
     ScriptableProject scope = rhino.initStandardObjects()
    String result = rhino.evaluateString(scope, evaluation,     "JavaScript", 1, null).toString()
    
1
2