The objective of this project is to create an APK for Ka-lite and make it runs on the embeded Python-for-Android interpreter. Therefore, user can use this app as a LAN server to serve open-scoure educational contents, or consume the content within the app's webview, without the access to the Internet.
More details about Ka-lite can be found here:
Wiki: https://github.com/learningequality/ka-lite/wiki
More details about how to use android-python27 can be found here:
Wiki: http://code.google.com/p/android-python27/w/list
Overview:
-
Before go with the following instruction, run the
prepare_python27_for_kalite.shscript on your terminal to add the necessary python modules for Ka-lite -
To use this project in Eclipse, just go to
File->Importand select the apk template folder. It's recommended that you then runProject->cleanto generateR.java -
The whole Ka-lite project is wrapped into the
ka-lite.zipfile underres/raw. -
The Python interpreter, including all binaries and modules, should be zipped into an archive and also placed inside the
res/rawdirectory. The template already has a zip archive containing the Python interpreter in this directory, so you don't need to change this if your APK runs fine. You can add modules that are needed for your scripts or remove them just by editing the files in this zip archive, or you can use your own Python build by replacing this zip archive with one containing your Python build (see the last bullet point below in this section about naming). -
If you change the name of the main Python script (
manage.py) or the name of the zip archive containing your Python scripts, then insrc/GlobalConstants.javachange the values for:Python_MAIN_SCRIPT_NAMEandPYTHON_PROJECT_ZIP_NAMErespectively. -
If you change the name of the zip archive containing the Python interpreter and the Python extras, then in
src/GlobalConstants.javachange the values for:PYTHON_NICE_NAME,PYTHON_ZIP_NAME, andPYTHON_EXTRAS_ZIP_NAMErespectively.
python-build:
-
Currently the
apkproject template above contains Python version 2.7.2 already built and included inside theapk/res/rawdirectory, so there's no need to build Python yourself. -
If you wish to build Python 2.7.2 however, you'll find the source code in
python-build(see README). This will build Python and create thepython_27.zipandpython_extras_27.ziparchives to replace the ones located inside theapk/res/rawdirectory.
Based on: