使用Android中的脚本语言脚本语言、Android

2023-09-05 07:09:47 作者:淡看悲欢离合

我想使用脚本语言我的项目,由于使其扩展,写了一些codeBase的吧内,因为它是比较容易实现的东西,在一个动态语言。类似像C# - >在.NET IronPython的桥梁;这意味着访问核心库,用Java编写的,从剧本。

I'd like to use a scripting language within my project due to make it extensible and write some of the codebase with it, since it would be easier to implement the stuff in a dynamic language. Similar like the C#->IronPython bridge in .NET; that means accessing the core libraries, written in Java, from the script.

我已经做了在网上的一些调查,我的即时通讯pression是,有没有真正的,稳定的可用于Android的解决方案。 。是我的假设是否正确?我想preFER Python的,但任何其他面向对象语言也将是对我很好。

I've done some investigations in the web and my impression is that there is no real, stable solution available for android. . Is my assumption correct? I'd prefer Python but any other OO-language would also be fine for me.

感谢。

推荐答案

我假设你已经驳回了 SL4A (脚本层为Android)。

I assume you've already dismissed the SL4A (Scripting Layer for Android).

该项目支持Python,BeanShell中,和其他一些脚本语言。这是完美的,如果你只是编写脚本/应用程序你自己,你会想要触发的东西,如区域设置和塔斯克,但是这将是一个疼痛,如果你想使一个完整的完成的应用程序与它合作。如果你想给它的一些例子一试,只要下载其演示的apk到手机和玩它。

That project supports Python, Beanshell, and a few other scripting languages. It's perfect if you're just writing scripts/applications for yourself, that you'd want to trigger with something like Locale or Tasker, but it will be a pain to work with if you want to make a complete finished application with it. If you want to give some of its examples a try, just download its demo apk to your phone and play around with it.

在这里真正的问题是该类型的应用程序,你真的想写。

The real issue here is the kind of application you really want to write.

有几个是有脚本语言Lua的一样或JavaScript pretty的良好支持的游戏引擎/物理引擎。然后,也有web视图基的Javascript / CSS / HTML机器人框架,可以是用于构建了一些简单的类型的机器人应用是有用的。还有一些基于Ruby或JavaScript框架,如罗德或Appcelerator的钛,旨在帮助您编写跨平台的基于表单的应用程序。

There are several game engines/physics engines that have pretty good support for scripting languages like Lua or Javascript. And then, there are also WebView-based Javascript/CSS/HTML Android frameworks that can be useful for building some simple types of Android applications. Also there are Ruby-based or Javascript frameworks like Rhodes or Appcelerator Titanium that are designed to help you write cross-platform form-based applications.

但除此之外,没有,我不相信你会找到一个被重写在Python是充分利用所有的Python的成语的Python所提供的(尚未反正SL4A试图API编程层,但它现在还没有)。正如你所说,取代了语言本身不是问题,这是很容易做到。它改写了Android API调用,以便它们完全意义上的你正在使用的脚本语言。

But otherwise, no, I don't believe you're going to find an API programming layer that was rewritten in Python that takes full advantage of all the Pythonic idioms Python has to offer (not yet anyway, SL4A is trying, but it's not there yet). As you said, replacing the language itself is not the issue, that's easy enough. It's rewriting the Android API calls so that they make complete sense in the scripting language you're using.