Programming Android apps in jython

2019-01-21 10:38发布

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.

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

7条回答
Lonely孤独者°
2楼-- · 2019-01-21 10:43

It's not possible. You can't use jython with android because the DVM doesn't understand it. DVM is not JVM.

查看更多
贼婆χ
3楼-- · 2019-01-21 10:54

I specially like Kivy

Scripting Layer for Android (SL4A) brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.

查看更多
贪生不怕死
4楼-- · 2019-01-21 10:57

Yes, you can.

Test your python code on your computer and, when it is ok, copy to your Android device.

Install Pydroid from Google Play Store and compile your code again inside the application and you will get your App ready and running.

Use pip inside Pydroid to install any dependencies.

PS: You will need to configure your Android device to install APKs from outside Play Store.

查看更多
Deceive 欺骗
5楼-- · 2019-01-21 10:59

Yes and no. With jython you can use java classes to compile for the JVM. But Android use the DVM (Dalvik Virtual Machine) and the compiled code is different. You have to use tools to convert from JVM code to DVM.

查看更多
男人必须洒脱
6楼-- · 2019-01-21 10:59

sadly No.

Mobile phones only have Java ME (Micro Edition) but Jython requires Java SE (Standard Edition). There is no Jython port to ME, and there is not enough interest to make it worth the effort.

查看更多
聊天终结者
7楼-- · 2019-01-21 11:01

As long as it compiles to pure java (with some constraints, as some APIs are not available), but I doubt that python will be of much use in development of android-specific stuff like activities and UI manipulation code.

You also have to take care of application size - that is serious constraint for mobile developement.

查看更多
登录 后发表回答