是否只能使用 Lua 为 Android 开发应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11786503/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:51:48  来源:igfitidea点击:

Is developing an application for Android using Lua only possible?

androidlua

提问by Straightfw

So I read this article on Mobile Orchardand, as I'm planning on having my first steps in Android development, it got me thinking: is it possible to develop for Android in Lua only? I Googled the topic but found no definitive answer. I know Java is the "base style" for Android but for the coding newbie which I am (elementary Python, basic C++), Lua seems somehow clearer and more friendly. Then here goes my question: can one develop an Android app using Lua only? If so, could you please show me some directions to move from here?

所以我在 Mobile Orchard 上阅读了这篇文章,当我计划在 Android 开发中迈出第一步时,它让我思考:是否可以仅在 Lua 中为 Android 进行开发?我用谷歌搜索了这个话题,但没有找到明确的答案。我知道 Java 是 Android 的“基本风格”,但对于我这个编码新手(初级 Python、基础 C++)来说,Lua 似乎更清晰、更友好。那么我的问题是:可以只使用 Lua 开发 Android 应用程序吗?如果是这样,你能告诉我一些从这里移动的方向吗?

采纳答案by Morrison Chang

The question is what kind of app do you want to build and what skills do you have. If you are already familiar with JavaScript there is Phonegap/Cordova. If you are building games there are a number of frameworks for 2D and 3D which use Lua. Some are free, others have licensing fees but are worth it if it provides a solution to your problem. All have pros and cons. For example I'm not sure if I would want to build an RSS reader in a game framework. Java is just another language, I would recommend just learning Java and the Android framework to start and knowing what is there before adding another application specific framework layer on top.

问题是您想构建什么样的应用程序以及您拥有哪些技能。如果您已经熟悉 JavaScript,则可以使用 Phonegap/Cordova。如果您正在构建游戏,则有许多使用 Lua 的 2D 和 3D 框架。有些是免费的,有些则需要支付许可费,但如果它为您的问题提供了解决方案,则值得。都有优点和缺点。例如,我不确定是否要在游戏框架中构建 RSS 阅读器。Java 只是另一种语言,我建议在添加另一个特定于应用程序的框架层之前,先学习 Java 和 Android 框架来开始并了解其中的内容。

回答by Paul Kulchenko

I've been developing a mobile application in Lua to control robots remotely from iOS and Android phones. The app is in pure Lua and runs on top of Mosync platformusing MobileLua. There is still some plumbing required, but it's not too complex.

我一直在用 Lua 开发一个移动应用程序来从 iOS 和 Android 手机远程控制机器人。该应用程序采用纯 Lua 编写,并使用MobileLuaMosync 平台之上运行。仍然需要一些管道,但它并不太复杂。

I also have a debuggerand a Lua IDE (ZeroBraneStudio) that support debugging of Lua scripts running remotely (including MobileLua scripts running on Android or iOS devices). I provide a demo appyou can use as a client to run simple scripts and check remote debugging in action.

我还有一个调试器和一个 Lua IDE ( ZeroBraneStudio),支持调试远程运行的 Lua 脚本(包括在 Android 或 iOS 设备上运行的 MobileLua 脚本)。我提供了一个演示应用程序,您可以将其用作客户端来运行简单的脚本并检查远程调试的运行情况。

[Update] If you are interested in more game oriented options, there are several available: (1) already mentioned Corona SDK, (2) Moai, and (3) Gideros Mobile. There is also Marmalade Quickand Cocos2d-x Lua bindings (for example, quick-cocos2d-x). All these toolkits/frameworks allow to develop in Lua.

[更新] 如果您对更多面向游戏的选项感兴趣,有几个可用选项:(1) 已经提到的Corona SDK,(2) Moai和 (3) Gideros Mobile。还有Marmalade Quick和 Cocos2d-x Lua 绑定(例如,quick-cocos2d-x)。所有这些工具包/框架都允许在 Lua 中进行开发。

Here is a detailed comparison of Moai vs. Corona.

这是Moai与Corona的详细比较。

回答by J. A. Whye

I know this is an older question, but just to correct some misinformation (in the comments) for people who come later, Corona SDK (as of spring 2013) has a Starter Edition which is free -- no splash screen or anything. The main difference between it and the "Pro" version is you can't do in-app purchases in the Starter Edition. But you can use it to create apps for sale, etc. No expiration date on it or anything.

我知道这是一个较旧的问题,但只是为了更正后来人的一些错误信息(在评论中),Corona SDK(截至 2013 年春季)有一个免费的入门版——没有启动画面或任何东西。它与“Pro”版本之间的主要区别在于您不能在 Starter Edition 中进行应用内购买。但是您可以使用它来创建应用程序以进行销售等。它没有到期日期或任何其他内容。

And in answer to the original question, learning Java may allow you to write Android apps, but if you then also want to target iOS you don't have any great options. By choosing something that's cross-platform from the beginning you can target Android or iOS or both. Lua (in any of the flavors already mentioned) is a great base language to learn for mobile development.

为了回答最初的问题,学习 Java 可能会让您编写 Android 应用程序,但是如果您还想针对 iOS,您就没有任何好的选择。通过从一开始就选择跨平台的东西,您可以针对 Android 或 iOS 或两者。Lua(在任何已经提到的风格中)是一种很好的学习移动开发的基础语言。

回答by amirfl

Corona SDKallows you to write iOS and Android apps in Lua. Its very easy to learn, but its not free. Edit: I saw you posted that you found Corona just after I sent my post...

Corona SDK允许您使用 Lua 编写 iOS 和 Android 应用程序。它很容易学习,但它不是免费的。编辑:我看到你发帖说你在我发完我的帖子后发现了电晕......

回答by mobiler.a

You can try http://scormpool.com/luastudioDevelop and run code on your device including iOS, Android, Mac, Win.

您可以尝试http://scormpool.com/luastudio在您的设备上开发和运行代码,包括 iOS、Android、Mac、Win。

Exporter can help you to make standalone app on listed above platforms.

Exporter 可以帮助您在上面列出的平台上制作独立的应用程序。

回答by James Penner

If only pure Lua then the answer is no.. unless you want to use a lot of libraries

如果只是纯 Lua 那么答案是否定的..除非你想使用很多库

If you want to make little Android app/games then use a game engine, learning is a step by step process, don't dive straight into the hard part.

如果你想制作小的 Android 应用程序/游戏然后使用游戏引擎,学习是一个循序渐进的过程,不要直接进入困难的部分。

回答by o080o

This may not be useful to the OP, however for other people interested in using lua to write their apps, I'd share my thoughts. So to answer the question:

这可能对 OP 没有用,但是对于其他有兴趣使用 lua 编写他们的应用程序的人,我会分享我的想法。所以要回答这个问题:

Yes, you canuse only lua to write apps for android using LuaJava from the kepler project (though I don't believe its being maintained anymore). You can create and manipulate Java objects seemlessly, and interact with the Android APIs through lua. You can even create UI elements dynamically using just lua. However, a small amount of java bootstrap code is needed to start the lua VM from your app. The AndroLuaproject is a great place to start for Android. The creator has done a lot of work making lua work with Android and packaging it all into an app. From experience I can say it works great! However, I would in no way recommend this to a beginner, as it requires a lot of knowledge about java andlua to make things work, meaning more work not less.

是的,您只能使用 lua 来使用 Kepler 项目中的 LuaJava 为 android 编写应用程序(尽管我不相信它会再被维护)。您可以无缝地创建和操作 Java 对象,并通过 lua 与 Android API 进行交互。您甚至可以仅使用 lua 动态创建 UI 元素。但是,从您的应用程序启动 lua VM 需要少量 java 引导程序代码。该AndroLua项目是一个伟大的地方开始为Android。创作者做了很多工作,让 lua 与 Android 兼容,并将其全部打包成一个应用程序。根据经验,我可以说它很好用!但是,我绝不会向初学者推荐这个,因为它需要大量关于 javalua的知识才能使事情正常工作,这意味着更多的工作而不是更少。

For AndroLua, just clone the repo and use that as a base for your own app. Last time I used it, I just imported it into android-studio, and after fixing a few problems with my own setup, had it compiling and running on my device.

对于 AndroLua,只需克隆 repo 并将其用作您自己的应用程序的基础。上次使用时,我只是将它导入到android-studio中,在解决了我自己的设置的一些问题后,让它在我的设备上编译并运行。