Android的编程在Jython的应用服务应用服务、Android、Jython

2023-09-04 08:35:27 作者:等待i

我碰到一个Python实现所谓的Jython的一天。 使用Jython,您可以编写Java应用程序与Python,并将其编译为纯Java。

The other day I came across a Python implementation called Jython. With Jython you can write Java applications with Python and compile them to pure Java.

我想知道:Android的编程与Java做。 那么,有可能使Android应用程序使用Jython?

I was wondering: Android programming is done with Java. So, is it possible to make Android apps with Jython?

推荐答案

Jython未编译为纯Java,它编译于的 Java字节code 的 - 也就是说,到 *。类文件。为了开发基于Android上,进一步编译Java字节code到的Dalvik字节code。这意味着,是的,​​Jython中的可以的让你使用Python的开发Android,但你得到它的发挥好了Android SDK(我没有亲自试过这一点,所以我不知道如何努力,它实际上是) - 你的执行的需要,以确保您不依赖于任何Java的API,Android不提供,而可能的需要有一定的当您运行的Jython Android的API 的.class 文件身边。除了这些niggles,你的核心思想应该工作 - Jython的呢,的确,让写code Python中,与在JVM上运行的其他任何交互

Jython doesn't compile to "pure java", it compiles to java bytecode - ie, to *.class files. To develop for Android, one further compiles java bytecode to Dalvik bytecode. This means that, yes, Jython can let you use Python for developing Android, subject to you getting it to play nice with the Android SDK (I haven't personally tried this, so I don't know how hard it actually is) - you do need to make sure you don't depend on any Java APIs that Android doesn't provide, and might need to have some of the Android API .class files around when you run jython. Aside from these niggles, your core idea should work - Jython does, indeed, let write code in Python that interacts with anything else that runs on the JVM.