Skip to content
This repository has been archived by the owner on Aug 15, 2017. It is now read-only.

A meta-package for building a version of Python that can be embedded into an Android project.

License

Notifications You must be signed in to change notification settings

pybee/Python-Android-support

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python-Android-support

WARNING: This project is DEPRECATED

This package is no longer under development. It is retained for historical purposes only.

It takes tha approach of compiling CPython as an embedded library for Android, and then bridging between the Python runtime and the Java virtual machine using JNI. This is a close analog to the approach taken by the Python-iOS-support library for Apple platforms.

However, the JNI layer on Android has a number of key restrictions that make this approach non-feasible. It also proved to be quite slow.

The maintainers abandoned this approach in favour of compiling Python bytecode directly to Java bytecode. For details on this approach, see VOC.

Description

This is a meta-package for building a version of Python (and supporting libraries) that can be embedded into an Android project.

It works by downloading, patching and building libraries in Android-compatible format.

It currently supports the ARM-EABI, which covers most Android devices. MIPS, x86, and ARM-v7A devices are not currently supported.

This repository branch builds a packaged version of Python 2.7.2, using Android API level 14 (Android 4.0 or higher), using Android NDK 10b.

Quickstart

Pre-built versions of the frameworks can be downloaded, and added to your Android project.

Alternatively, to build the frameworks on your own:

  1. Download the Android SDK and NDK:

  2. Add the Android SDK /tools directory to your path.

  3. Launch android, and make sure you have all the necessary parts of the SDK. You can do this using the graphical interface, or using the command line:

    $ android update sdk -u -a -t android-14
    
  4. Export the following environment variables:

    $ export ANDROIDSDK="/path/to/android/android-sdk-<platform>"
    $ export ANDROIDNDK="/path/to/android/android-ndk-r10b"
    

    (of course, update these paths to point to the actual SDK and NDK directories)

  5. Clone the Python-Android-support repository:

    $ git clone git://github.com/pybee/Python-Android-support
    
  6. Build the distribution:

    $ cd Python-Android-support
    $ ./build.sh
    

    This should:

    1. Download the original source packages.
    2. Patch them as required for Android compatibility
    3. Build the packages into Android-compatible libraries

    The finished products will be be in the dist directory, ready for inclusion in your Android project.

Acknowledgements

This project is derived from groundwork provided by Kivy's Android packaging tools.

About

A meta-package for building a version of Python that can be embedded into an Android project.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 61.1%
  • Makefile 38.5%
  • Python 0.4%