构建跨平台应用程序 - 推荐

发布于 2024-08-22 22:20:44 字数 2051 浏览 13 评论 0 原文

我需要构建一个相当简单的应用程序,但它需要在 PC 和 Mac 上运行。

它还需要作为独立的桌面应用程序在光盘或 USB 驱动器上重新分发。

最初,我认为 AIR 非常适合此操作(它满足所有 API 要求),但困难在于使其可分发,因为该应用程序需要安装 AIR 运行时才能运行。

我发现 Shu Player 作为一个选项,因为它似乎能够将 AIR 运行时与应用程序并进行(静默?)安装。
然而,这似乎违反了 Adob​​e 的条款和条件 (如此处所述),所以我不确定其合法性。

另一种选择可能是锌,但我还没有测试过,所以我不确定它是否符合要求。

您会推荐或建议我查看什么?

任何建议都非常感谢

编辑: 关于单声道使用还有一些更多的讨论(尽管没有真正的结论): 此处此处

编辑2也许也符合要求,会检查一下。

还有其他人的评论吗?

EDIT3(一年后):自从我发布这个问题以来实际上已经快一年了,但似乎有些人仍然时不时地遇到它,甚至贡献一个答案,甚至一年后。

我想我会稍微更新一下问题。最后我没有抽出时间尝试 tcl/tk 选项,时间限制以及与不同操作系统版本的兼容性的不确定性导致我放弃了该选项。

我确实尝试过 Titanium,但尽管第一印象还不错,但他们确实比其他任何东西都更能推动移动平台的发展,而且恕我直言,桌面实施由于缺乏关注而受到了一些影响。还有一些关于某些操作系统上的某些 Visual Studio 运行时的问题的报告(但现在不记得细节了)..所以也放弃了。

我最终选择了 XULRunner。两个主要吸引力是:

  • Firefox 似乎可以在大多数操作系统版本上开箱即用,因此我相信 XULRunner 应用程序可能与大多数系统兼容。节省了我大量的测试时间,事实证明它在所有平台上都运行得非常好,没有一个无法启动应用程序的报告,
  • 这是 Javascript 宝贝!语言学习曲线很小。主要要解决的是额外的 xpcom 接口是什么以及如何查询它们。

不利的一面是:

  • 我认为排除错误有时是一项艰巨的任务,venkman 调试器有点笨重,最终更多地使用控制台。
  • sqlite 界面对于桌面应用程序来说是一个很好的资产,但当某些东西不起作用时,我经常很难找到相关的错误信息 - 也许我做错了。
  • 我们花了一些时间才弄清楚如何将应用程序打包为适用于 PC 和 Mac 的独立应用程序。最后的方法是拥有一个“shell”mac 应用程序和一个 shell PC 应用程序以及几个“编译”脚本,这些脚本将复制 shell 并将自定义源代码添加到正确的位置。
  • 对于某些人来说,最后一个潜在问题是,由于 xulrunner 应用程序的性质,您的源代码将与应用程序一起部署,如果您愿意,您可以使用混淆,但如果您想保护您的知识产权,请记住这一点

总而言之,跨平台应用程序的绝佳平台。我强烈推荐它。

I need to build a fairly simple app but it needs to work on both PC and Mac.

It also needs to be redistributable on a disc or usb drive as a standalone desktop app.

Initially I thought AIR would be perfect for this (it ticks all the API requirements), but the difficulty is making it distributable, as the app would require the AIR runtime to be installed to run.

I came across Shu Player as an option as it seems to be able to package the AIR runtime with the app and do a (silent?) install.
However this seems to break the T&C from Adobe (as outlined here) so I'm not sure about the legality.

Another option could be Zinc but I haven't tested it so I'm not sure how well it'll fit the bill.

What would you recommend or suggest I check out?

Any suggestion much appreciated

EDIT:
There's a few more discussions on mono usage (though no real conclusion):
Here and Here

EDIT2:
Titanium could also fit the bill maybe, will check it out.

Any more comments from anyone?

EDIT3 (one year on): It's actually been almost a year since I posted that question but it seems some people still come across it every now and then, and even contribute an answer, even a year later.

Thought I'd update the question a bit. I did not get around to try the tcl/tk option at the end, time constraint and the uncertainty of the compatibility to different os versions led me to discard that as an option.

I did try Titanium for a bit but though the first impressions were ok, they really are pushing the mobile platform more than anything, and imho, the desktop implementation suffers a bit from that lack of attention. There are also some report of problems with some visual studio runtime on some OSs (can't remember the details now though).. So discarded that too.

I ended up going with XULRunner. The two major appeals were:

  • Firefox seems to work out of the box on most OS version, so I took it as good faith that a XULRunner app would likely be compatible with most system. Saved me a lot of testing and it turned out that it did run really well on all platforms, there hasn't been a single report of not being able to start the app
  • It's Javascript baby! Language learning curve was minimal. The main thing to work out is what the additional xpcom interfaces are and how to query them.

On the down side:

  • I thought troubleshooting errors was a sometimes difficult task, the venkman debugger is kinda clunky, ended up using the console more than anything.
  • The sqlite interface is a great asset for a desktop app but I often struggled to find relevant error infos when something didn't work - maybe i was doing it wrong.
  • It took a little while to work out how to package the app as a standalone app for both PC and Mac. The final approach was to have a "shell" mac app and a shell pc app and a couple of "compile" script that would copy the shells and add the custom source code onto it in the correct location.
  • One last potential issue for some, due to the nature of xulrunner apps, your source code will be deployed with the app, you can use obfuscation if you want but that's something to keep in mind if you want to protect your intellectual property

All in all, great platform for a cross-platform app. I'd highly recommend it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

扛刀软妹 2024-08-29 22:20:44

Tcl/Tk 拥有最好的包装解决方案之一。您可以使用特定于平台的二进制文件轻松包装跨平台应用程序(在完全工作的虚拟文件系统中实现),以获得适用于任何现代桌面系统的单个文件可执行文件。在 google 中搜索术语 starkit、starpack 和 tclkit。与当今的许多可执行文件相比,此类打包的二进制文件很小。

许多人嘲笑 Tk“老旧”或“不成熟”,但它是最古老、最稳定的工具包之一。当存在此类小部件时,它会使用本机小部件。

然而,Tcl/Tk 的一个显着缺点是它缺乏任何类型的打印支持。如果您的申请需要打印,您就必须有点创意。有特定于平台的解决方案、生成 postscript 文档的能力以及创建 pdf 的库,但这需要一些额外的努力。

Tcl/Tk has one of the best packaging solutions out there. You can easily wrap a cross-platform application (implemented in a fully working virtual filesystem) with a platform-specific binary to get a single file executable for just about any modern desktop system. Search google for the terms starkit, starpack and tclkit. Such wrapped binaries are tiny in comparison to many executables these days.

Many deride Tk as being "old" or "immature" but it's one of the oldest, most stable toolkits out there. It uses native widgets when such widgets exist.

One significant drawback of Tcl/Tk, however, is that it lacks any sort of printing support. If your application needs to print you'll have to be a bit creative. There are platform-specific solutions, and the ability to generate postscript documents, and libraries to create pdfs, but it takes a little extra effort.

顾忌 2024-08-29 22:20:44

Java 可能是您最好的选择,尽管并非所有 Windows PC 都一定有 Java(大多数应该)。 JavaFX 太新了,你不能指望它 - 你可能会发现很多机器运行 Java 1.5 或(不寒而栗)1.4。我相信最近的 Mac OS 仍然搭载 1.5(最新版本可能已更改为 1.6)。

Java is probably your best bet, although not all Windows PCs will necessarily have Java (most should). JavaFX is new enough you can't count on it - you'll probably find a lot of machines running Java 1.5 or (shudder) 1.4. I believe recent Mac OS still ships with 1.5 (latest version may have changed to 1.6).

伴我老 2024-08-29 22:20:44

考虑JavaFX
有了现代 JRE,它就可以在任何地方运行......!

Consider JavaFX
It would run everywhere with a modern JRE ..!

反差帅 2024-08-29 22:20:44

AIR 可能是一种选择,但前提是您不介意分发两个不同的文件(离线运行时安装程序和您的应用程序),并期望用户运行一个文件,然后运行另一个文件。在 Adob​​e 为您提供安装程序之前,您必须在 Adob​​e 网站上提交一份在线表格,表明您同意按原样分发离线安装程序,而不是挖掘单个 DLL 或其他任何内容。

不幸的是,目前还没有办法从一个文件中同时安装 AIR 应用程序和运行时。我不确定与 Shu 的交易是什么,或者它是否做了任何不道德的事情。

AIR could be an option, but only if you don't mind distributing two different files (the offline runtime installer and your app), and expecting the user to run one and then the other. You do have to submit an online form at Adobe's site saying you agree to distribute the offline installer as-is, rather than digging out individual DLLs or whatever, before they give you the installer.

Unfortunately there's currently no way to get both an AIR app and the runtime to install from one file though. I'm not sure what the deal with Shu is, or whether it's doing anything that isn't kosher.

勿忘初心 2024-08-29 22:20:44

我会推荐锌。它具有桌面所需的所有功能。然而,我上次使用它时有点小故障。

我因试图将 6M 文件写入磁盘而挂断。我想了想,将代码更改为一次写入 512K 块(3 分钟工作,很快)。

也许它仍然有一些烦人的小故障,比如让你考虑 root lvl,但易用性和功能实在是太可爱了,不容忽视。

i would recommended zink. it has all the functionalities you require for desktop. however, the las time i used it it was a bit glitchy.

i was hung up by trying to write a 6M file to the disk. thought it trough and changed the code to write 512K chunks at a time (3min work, fast).

probably it still has some little annoying glitches like making you think on root lvl but the ease of use and the features are just way too sweet to ignore.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文