5

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 for something that would generate a '.apk' without having to install the 'scripting' package... annoying for end-users.

4 Answers 4

6

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

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

3

try jython - python implementatjon for the jvm

Comments

2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.