Is there such a thing as a "translator" (for lack of a better word in my mind now) that translates Python code directly to JVM / Dalvik bytecode?
Would be great for writing Android applications in Python!
NOTE: I know about the scripting capabilities of the Android platform but I am looking fo开发者_StackOverflow社区r something that would generate a '.apk' without having to install the 'scripting' package... annoying for end-users.
Yes you can go to Java bytecode using jythonc
. Though I'm not sure how well that would work with the Dalvik format's subtle differences.
edit: apparently there was a jythonroid
project which aims to do exactly what you want, but they abandoned it in favor of SL4A
For running python code on a JVM, check out Jython
As far as dalvik, I'm not aware of any way to convert python to dalvik. Although there is the Android Scripting Enviornment which allows you to run several scripting languages in android.
try jython - python implementatjon for the jvm
According to the Wikipedia entryon Dalvik and Daniel's answer, I think you may try compile into Java bytecode using jythonc and then use the dx tool to convert it to .dex files.
From the wikipadia:
A tool called dx is used to convert some (but not all) Java .class files into the .dex format.
Let us know if this works.
精彩评论