This is the first draft, should be further modified, after all, illustrations better edible, suggestions and comments despite comments, progress together! On a 51cto above, it should be in the future, the 51cto blog editing system is really torture goblin
0x01 System Configuration
System and Python parameters
Linux gnu-virtualbox 3.16.0-23-generic #31-ubuntu SMP Tue Oct 18:00:35 UTC i686 i686 i686 gnu/linux
Python 2.7.8
Lubuntu 14.10
0x02 installation Kivy
Install Kivy, Pygame, Cython with new downloads
Settings-Software Library-Select the fastest server, refresh
Search and install Python-kivy, Pygame, Cython, Kivy-examples
Kivy and Pygame are located in/usr/lib/python2.7/dist-packages
Cython–v
Cython version 0.20.2
Kivy-examples is located in/usr/share/kivy-examples
Try running a program now
python/usr/share/kivy-examples/guide/firstwidget/1_skeleton.py
0x03 Installing OPENJDK, Pyjnius
Installing OPENJDK
Install OPEN-JDK-7-JDK using the new stand-up download.
Configuring Environment variables
Export java_home=/usr/lib/jvm/java-1.7.0-openjdk-i386
Export Jdk_home= $JAVA _home
Export Jre_home= $JAVA _home/jre
Export classpath=.: $JAVA _home/jre/lib/rt.jar: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $JAVA _home/bin: $JRE _home/bin: $PATH
Installing Jnius
Download Jnius source code from GitHub and unzip it to ~/
sudo python setup.py install
Warning appears: Unknown distribution option: ' Install_requires '
Install PYTHON-PIP, python-setuptools with new stand-up downloads
Reference Http://stackoverflow.com/questions/8295644/pypi-userwarning-unknown-distribution-option-install-requires:
Use Distutils to rebuild tar.gz, install with PIP.
Python setup.py sdist
CD Dist
sudo pip uninstall Jnius
sudo pip install jnius-1.1-dev.tar.gz
Although there are some errors, you can use them.
0x04 install some of the libraries you need to pack apk
Refer to http://python-for-android.readthedocs.org/en/latest/prerequisites/using the new Rieter installation Zlib1g-dev, Build-essential patch Git-core CCache Libsdl1.2-dev
Installing Jinja2,sudo pip install JINJA2 with PIP
Refer to the http://segmentfault.com/q/1010000000628558 settings agent download or download the Android 4.0 SDK directly from http://www.androiddevtools.cn/. Platform-tools, Build-tools
0x05 using Buildozer pack apk
sudo pip install Buildozer
Switch to the project directory, the project entry point of the source code file must be named main.py, at the beginning of the file with the APK package you want to add the version number such as: __version__ = "1.1.0"
Buildozer Init #在项目目录下生成buildozer. Spec
Buildozer Android Debug #会自动下载ant, SDK, NDK
# Check Configuration Tokens
# Ensure build Layout
# Check Configuration Tokens
# Preparing Build
# Check Requirements for Android
# Install Platform
# Android ANT is missing, downloading
# Apache ANT installation done.
# Android SDK is missing, downloading
# Unpacking Android SDK
# Android SDK installation done.
# Android NDK is missing, downloading
# Unpacking Android NDK
In my case, although the Internet has been scientific but downloaded ~/.buildozer/android/platform/android-sdk-21 Android SDK Manager does not normally download the SDK, Build-tools, etc. So I copied it from the official Buildozer VM (the link to FQ) and the android-sdk-21 (which is safe to eat here without a ladder). Rename the original android-sdk-21 to Android-sdk-bak (you can delete it, of course).
Open the Buildozer.spec of the project directory and change the 151th line to Log_level = 2, which will display verbose debug log when packaging to make it easier to find errors.
At the time of recompiling the item, first delete the. Buildozer in the project directory and then run
Buildozer Android Debug
If everything goes well, you'll see the bin directory in the project directory, and you can open the Bin directory to see the generated apk.
The road of Kivy Learning--the Linux chapter of development environment Erection