适用于Android的Jython

Ere*_*oid 5 android jython

我正在测试Jython for Android取自这里http://code.google.com/p/jython-for-android/

不幸的是我在发布期间遇到了问题...我尝试在我的一个项目中导入所有库,并在方法onCreate of my activity中输入以下代码:

  PythonInterpreter interpreter = new PythonInterpreter();
  interpreter.exec("print 'hello from Jython!' ");
Run Code Online (Sandbox Code Playgroud)

这段代码应该可以工作(就像在标准java中一样),但是我得到了这个:

Traceback (innermost last):
 (no code object) at line 0
java.lang.NullPointerException
      at org.python.core.BytecodeLoader.makeCode(BytecodeLoader.java:104)
      at org.python.core.Py.compile_flags(Py.java:1685)
      at org.python.core.Py.compile_flags(Py.java:1698)
      at org.python.core.Py.compile_flags(Py.java:1706)
      at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:135)
      at org.python.util.InteractiveConsole.interact(JythonForAndroidTest.java:29)
Run Code Online (Sandbox Code Playgroud)

我还从repo下载了最后一个版本,但没有任何变化...我将构建目标设置为2.1update ...

可能是什么?任何人都有这个lib的经验吗?

提前谢谢^^

干杯

jam*_*ams 0

如果您可以使用 python 而不是 jython,请尝试一下 QPython,您可以从您的设备、整个项目加载脚本并从 QR 代码加载!它也有一个控制台和编辑器!

我目前没有平板电脑,但当我拥有一台平板电脑时,我将使用它。目前在Note3上使用它。

Qpython主页

  • 当问题的标题、正文和标签三者都表明 OP 使用语言 B 时,使用语言 A 进行回答并不会使您的答案真正相关。 (2认同)