Android 开发:Java 和 C/C++在应用程序中编译功能可能吗?

发布于 2024-11-25 14:25:05 字数 183 浏览 0 评论 0原文

我想知道是否有可能为 Android 创建一个类似 IDE 的应用程序,用户可以编写一些 Java 或 C/C++ 代码,并能够编译它、运行它并在 Android 应用程序中给出输出? (不是桌面!)。

如果可以的话,有什么限制?我认为会有一些限制,比如用户无法制作 GUI 并执行它们,还是我错了?

谢谢, 亚历克斯.

I was wondering if it's possible to make an IDE-like application for Android where users can write some Java or C/C++ code and be able to compile it, run it and be given the output in an Android application? (Not desktop!).

If it is possible, what are the limitations? I presume there'd be limits like the user wouldn't be able to make GUI's and execute them, or am I wrong?

Thanks,
Alex.

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

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

发布评论

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

评论(2

铃予 2024-12-02 14:25:05

是的,这是可能的。这些应用程序称为 IDE。这些背后并没有什么特殊的魔力 - IDE 只是另一个程序,尽管通常是一个相当大且复杂的程序。

也就是说,你为什么要这么做?已经有很多 IDE 了。如果你想锻炼一下,也许一些不那么雄心勃勃的事情会是更好的选择。

您的 IDE 没有理由阻止用户创建 GUI 程序。毕竟,现有的 IDE 可以让您做到这一点。

此外,还有高度可定制的 IDE(首先想到的是 Eclipse 和 Visual Studio),因此,如果您缺少一些功能,有时您可以为此编写/查找 IDE 插件。

如果您没有 IDE 并且想要一个免费的,Eclipse 是免费的。它完全支持 Java 和 C++。这比从头开始创建另一个要自由得多,而且还需要时间成本。

编辑:我明白了。现在,限制是:小屏幕、缺乏(通常)硬件键盘、有限的内存、有限且缓慢的磁盘、电池寿命、过热……应用程序开发是一项昂贵的任务。

EDIT2:看起来您并不追求 Android 上的通用应用程序开发,但希望您的应用程序可由最终用户编写脚本。如果确实如此,那么 C++ 和 Java 就不是最需要支持的语言。 Android 已经附带了脚本语言的解释器 - 该语言是 JavaScript,解释器是 WebView。

Yes, it is possible. Those applications are called IDE's. There's no special magic behind those - an IDE is just another program, albeit typically a rather big and complicated one.

That said, why would you want to do that? There are plenty of IDE's out there already. If you want an exercise, maybe something less ambitious would be a better choice.

There's no reason why your IDE should prevent the user from making GUI programs. After all, existing IDE's would let you.

Also, there are IDE's out there that are highly customizable (Eclipse and Visual Studio come to one's mind first), so if you're missing a bit of functionality, sometimes you can write/find an IDE plug-in for that.

If you don't have an IDE and want a free one, Eclipse is free. It supports Java and C++ all right. That would be much freer that creating another from scratch - time costs, too.

EDIT: I see. Now, the limitations are: small screen, lack (typically) of a hardware keyboard, limited memory, limited and slow disk, battery lifetime, overheating... App development is an expensive task.

EDIT2: looks like you're not after general purpose application development on Android, but want your app to be scriptable by end user. If that's indeed the case, C++ and Java are not the best languages to support. Android already comes with an interpreter for a scripting language - the language is JavaScript, and the interpreter is WebView.

爱本泡沫多脆弱 2024-12-02 14:25:05

随着时间的推移,这里的可能性越来越多。

AIDE,Android Java IDE 是相当成功,自由的环境。您可以在 Android 设备上创建 Android 应用程序。它由德国团队持续开发。现在有语法高亮、修复导入、代码完成、重构、与 Eclipse 的兼容性、与 Dropbox 的连接、git pull(以及高级版本中的推送)。

您还可以找到(非免费)C/C++ 编译器,例如 这个。我没有使用它们的经验,根据用户的反馈,第一个确实很好。

主要限制可能是屏幕尺寸,如果您没有外部键盘,情况会变得更糟。在 Tegra 设备上的性能似乎还不错 - 我使用带有 Tegra2 的 7 英寸 Iconia Tab A100 - 但我认为现在它是基于台式机/笔记本电脑的开发的辅助解决方案。我现在认为最后一句话可能很快就会过时。

As time goes there are more and more possibilities here.

AIDE, the Android Java IDE is quite successful, free environment. You can create Android applications on your Android device. It is in a continuous development by a German team. Now there is syntax highlight, fix imports, code completion, refactoring, compatibility with Eclipse, connection with Dropbox, git pull (and push in the premium version).

You can also find (non-free) C/C++ compiler like this or this. I have no experience with them, the first is really good according to the user responses.

The main limitation can be the screen size and if you have no external keyboard then it gets worse. The performance seems to be OK on a Tegra device - I use a 7-inch Iconia Tab A100 with Tegra2 -, however I think right now it is an auxiliary solution to a desktop/laptop based development. I now that the last sentence soon may become obsoleted.

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