How To Install Interpreter For Sl4a In Offline
Solution 1:
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.
A key was paying attention to the logcat
error messages. As I had no version files, the code asked for an _r1.zip
always.
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 @@ publicclassPythonDescriptorextendsSl4aHostedInterpreter {
publicstaticfinalStringENV_EXTRAS="PY4A_EXTRAS";
publicstaticfinalStringENV_EGGS="PYTHON_EGG_CACHE";
publicstaticfinalStringENV_USERBASE="PYTHONUSERBASE";
- publicstaticfinalStringBASE_URL="http://python-for-android.googlecode.com/";
+ publicstaticfinalStringBASE_URL="file:///data/data/tmp/";
privatestaticfinalintLATEST_VERSION= -1;
privateintcache_version= -1;
privateintcache_extras_version= -1;
Once you have the .apk
, go ahead and install everything:
pushd android/PythonForAndroid
adb install -r bin/PythonForAndroid-debug.apk
popdpushd 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
The final step is to launch Py4A, and poke Install
.
Solution 2:
The straightforward way that I found is to install everything in online mode once, then compress the contents of directories:
/data/data/com.googlecode.{language}forandroid,
/sdcard/com.googlecode.{language}forandroid,
/sdcard/sl4a
And make any subsequent install using following batch script (Windows)
set ADB_BIN="C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe"
%ADB_BIN% install -r sl4a_r4.apk%ADB_BIN% install -r PythonForAndroid_r4.apk%ADB_BIN% install -r perl_for_android_r1.apk%ADB_BIN% install -r lua_for_android_r1.apk
%ADB_BIN% push sd.tgz /sdcard/%ADB_BIN% shell busybox tar -xzf /sdcard/sd.tgz -C /sdcard%ADB_BIN% push data.tgz /sdcard/%ADB_BIN% root%ADB_BIN% remount%ADB_BIN% shell busybox tar -xzf /sdcard/data.tgz -C /data/data
%ADB_BIN% shell rm /sdcard/sd.tgz%ADB_BIN% shell rm /sdcard/data.tgz
Post a Comment for "How To Install Interpreter For Sl4a In Offline"