I have an android app that users should be able extend using scripts. That's the plan anyway. Users can write scripts which are saved into a folder on their flash and accessed from a menu in the app. The scripts are loaded up and called based on certain events in the application. The application will expose helper methods and objects into the script's context so it can tap functionality in the app in a controlled way.

我有一个Android应用程序,用户应该能够使用脚本扩展。无论如何,那是计划。用户可以编写保存在闪存中的文件夹中的脚本,并从应用程序的菜单中访问。根据应用程序中的某些事件加载和调用脚本。应用程序会将辅助方法和对象公开到脚本的上下文中,以便它可以以受控方式点击应用程序中的功能。

Therefore my requirements are:

因此我的要求是:

  • Low disk / memory footprint
  • 低磁盘/内存占用

  • Fast startup
  • Android compatible
  • Reasonable parsing / error reporting
  • 合理的解析/错误报告

  • Simple, sane syntax preferably a dialect of a popular language, e.g. Basic, JS, Python etc.
  • 简单,理智的语法优选地是流行语言的方言,例如,基础,JS,Python等

  • Language must support arrays, associative arrays, double precision floats, string manipulation. It doesn't need network access or much else.
  • 语言必须支持数组,关联数组,双精度浮点数,字符串操作。它不需要网络访问或其他许多功能。

  • Clean load & unload of scripts
  • 清理加载和卸载脚本

  • Something that accommodates an event driven model
  • 适合事件驱动模型的东西

  • Security / sandbox model which prevents scripts doing things beyond the APIs I expose to them
  • 安全/沙箱模型,它可以防止脚本执行超出我公开的API的操作

  • Timeout / error handling so I can kill scripts which take too long or get stuck in loops (so people don't downrank my app for their script's fault).
  • 超时/错误处理因此我可以杀死花费太长时间或陷入循环的脚本(因此人们不会因为脚本的错误而拒绝我的应用程序)。

I have looked over the likes of Rhino and Jython and I get the impression they would impose far too great an overhead for my purposes. I also suspect they might be hard to coral into the limited security model I have in mind (e.g. Rhino exposes all Java classes by default and this has to be hacked around).

我已经看过Rhino和Jython之类的东西了,我觉得他们会为我的目的施加太大的开销。我还怀疑他们可能很难融入我想到的有限安全模型(例如,Rhino默认暴露所有Java类,这必须被黑客入侵)。

What recommendations would people give?

人们会给出什么建议?

1 个解决方案

#1


0

Take a look at SL4A project. I'm not sure if it provides what you need, but at least it's a place where I would have started.

看看SL4A项目。我不确定它是否提供了你所需要的,但至少它是我开始的地方。

更多相关文章

  1. 如何使用java RESTful Web服务将通知推送到Android应用程序
  2. android 获取正在运行的应用程序列表
  3. 如何开始为Android开发应用程序? [重复]
  4. 王家林最受欢迎的一站式云计算大数据和移动互联网解决方案课程 V
  5. 当在调试模式下启动时,Android应用程序崩溃。
  6. 基于Java的应用程序的GUI测试工具
  7. 为内存密集型应用程序增加JVM最大堆大小
  8. java与ASP.NET网络应用程序在生命期开始时的比较。
  9. java小练习(一个数如果恰好等于它的因子之和,这个数就称为“完数”

随机推荐

  1. Android使用addView动态添加组件
  2. android小说阅读源码、bilibili源码、MVP
  3. android:screenOrientation属性(转)
  4. 连线:纯正Android已死 “Android兼容设备
  5. Android hardware so加载流程
  6. ListView的一些应用
  7. android rom短信模块最后获取的Cursor字
  8. Android(安卓)TextView 添加下划线的几种
  9. Android那些事儿(一)成长中的Android
  10. 使用Vitamio打造自己的Android万能播放器