本文介绍了如何在离线安装间preTER为SL4A的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我目前的工作在的Perl / Python的/ LUA脚本机器人很感兴趣,但我也很流量消耗的限制,我可能需要频繁重复间preters重新刷新Android设备安装后的程序。那么,有没有办法使用prepared文件/档案没有互联网连接的SL4A安装间preters?

I'm really interested in android scripting on perl/python/lua at my current job, but I'm also very limited in traffic consumption and I may need frequently repeat interpreters install procedure after reflashing android devices. So is there any way to install interpreters in SL4A using prepared files/archives without internet connection?

推荐答案

有关安装Py4a,我结束了修改的Andr​​oid / PythonForAndroid / src目录/ COM /谷歌code / pythonforandroid / PythonDescriptor.java ,修改 BASE_URL 有成的file:/// URL。当时我能够亚行推蟒蛇_ *。拉链文件到该目录,并从那里安装。

For installing Py4a, I ended up modifying android/PythonForAndroid/src/com/googlecode/pythonforandroid/PythonDescriptor.java, changing BASE_URL there into a file:/// URL. I was then able to adb push the python_*.zip files into that directory, and install from there.

一个键被关注的的logcat 错误消息。由于我没有版本的文件中,code要求的 _r1.zip 始终。

A key was paying attention to the logcat error messages. As I had no version files, the code asked for an _r1.zip always.

下面的补丁,然后只需按照 README Py4A的文件以生成APK的说明。

Apply the following patch, and then just follow the instructions in the README file of Py4A to build the APK.

diff --git a/android/PythonForAndroid/src/com/googlecode/pythonforandroid/PythonDescriptor.java b/android/PythonForAndroid/src/com/googlecode/pythonforandroid/PythonDescriptor.java
index a891e98..89bb4f7 100644
--- a/android/PythonForAndroid/src/com/googlecode/pythonforandroid/PythonDescriptor.java
+++ b/android/PythonForAndroid/src/com/googlecode/pythonforandroid/PythonDescriptor.java
@@ -39,7 +39,7 @@ public class PythonDescriptor extends Sl4aHostedInterpreter {
   public static final String ENV_EXTRAS = "PY4A_EXTRAS";
   public static final String ENV_EGGS = "PYTHON_EGG_CACHE";
   public static final String ENV_USERBASE = "PYTHONUSERBASE";
-  public static final String BASE_URL = "http://python-for-android.googlecode.com/";
+  public static final String BASE_URL = "file:///data/data/tmp/";
   private static final int LATEST_VERSION = -1;
   private int cache_version = -1;
   private int cache_extras_version = -1;

一旦你的 .apk文件,继续和安装的一切:​​

Once you have the .apk, go ahead and install everything:

pushd android/PythonForAndroid
adb install -r bin/PythonForAndroid-debug.apk
popd

pushd python-build
adb shell mkdir -p /data/data/tmp/files
adb push python_r16.zip /data/data/tmp/files/python_r-1.zip
adb push python_extras_r14.zip /data/data/tmp/files/python_extras_r-1.zip
adb push python_scripts_r13.zip /data/data/tmp/files/python_scripts_r-1.zip
popd

最后一步是启动Py4A,捅安装

这篇关于如何在离线安装间preTER为SL4A的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 06:48