我正在测试 Jython for Android 取自这里 http://code.google.com/p/jython-for-android/
不幸的是,我在启动过程中遇到了问题...我尝试导入 我的一个项目和 onCreate 方法中的所有库 在我的 Activity 中,我输入了这段代码:
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("print 'hello from Jython!' ");
这段代码应该可以工作(就像在标准 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)
我也从 repo 下载了最新版本,但没有任何变化...... 我将构建目标设置为 2.1update...
可能是什么?有人对此库有任何经验吗?
提前致谢^^
干杯
最佳答案
如果你可以处理 python 而不是 jython,试试 QPython,你可以从你的设备加载脚本,整个项目并从二维码加载!它也有一个控制台和编辑器!
我目前没有平板电脑,但我会在拿到平板电脑后使用它。目前在 Note3 上使用它。
关于android - Android 版 Jython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6396594/