Run Python apps, Scripts on Android

If you’re a python developer and lazy enough to not learn Java for Android app development, we got a number of solutions for you. You may not be lazy, but you want to run your existing Python scripts on Android, this guide will help you get there.

We love Python as much as Java, so we decided to compile all possible ways to Run Python on Android and even iOS.

Lets look at a number of solutions that would help you run Python on Android.

Method 1: Kivy

Kivy is an open source Python library for quickly developing Android based applications that make use of innovative user interfaces, such as multi-touch apps. Kivy runs on Linux, Windows, MacOSX, Android and iOS. You can run the same code on all supported platforms, without any ports.

Kivy is a modern cross-platform Python GUI toolkit that runs on mobile devices (Android and iPhone) and supports modern input events (multitouch, accelerometor). The best way to describe the Kivy Language is “what HTML5 wishes it was.” It is mostly just a layout language, but it also supports binding properties and events using inline Python snippets. It is indentation defined, like Python, and utilizes a minimal amount of syntax with a maximal amount of readability. You can checkout sample here.

It comes with native support for many multi-touch input devices, a growing library of multi-touch aware widgets and hardware accelerated OpenGL drawing. Kivy is designed to let you focus on building custom and highly interactive applications as quickly and easily as possible.

With Kivy, you can take full advantage of the dynamic nature of Python. There are thousands of high-quality, free libraries that can be integrated in your application. At the same time, performance-critical parts are implemented in the C language.

Kivy is able to run on any android, but you need a phone with atleast:

  • SD Card
  • OpenGL ES 2.0 (Android 2.2 minimum)

 

Showcase app on PlayStore

Project Website

 

Method 2: ASE Android Scripting Environment

The Android Scripting Environment (ASE) is Google’s official answer to making scripting developer’s life easier on Android. Scripting languages can be used to develop full fledged Android applications.

The ASE allows developers to develop directly on the Android powered device without the need for a separate computer using Android’s development environment.

Scripts can be run interactively in a terminal, started as a long running service, or started via Locale. Python, Lua and BeanShell are currently supported, and we’re planning to add Ruby and JavaScript support, as well.

The ASE scripts will allow access to many of the API’s that are available to application developers. The major API features include:

  • Handle intents
  • Start activities
  • Make phone calls
  • Send text messages
  • Scan bar codes
  • Poll location and sensor data
  • Use text-to-speech (TTS) and many more

More at project site, official blog post

Method 3: SL4A: Scripting Layer for Android

Scripting Layer for Android (SL4A) is essentially extension of ASE, and allows you to edit and execute scripts and interactive interpreters directly on the Android device. These scripts have access to many of the APIs available to full-fledged Android applications, but with a greatly simplified interface that makes it easy to get things done.

Scripts can be run interactively in a terminal, in the background, or via Locale. Python, Perl, JRuby, Lua, BeanShell, JavaScript, Tcl, and shell are currently supported, and we’re planning to add more. See the SL4A Video Help playlist on YouTube for various demonstrations of SL4A’s features.

SL4A was used by the Nexus One payload for sensor logging. See the article in Make for more information about the project.

More info at Project site. Also checkout Python for Android (Py4a), which is used in-conjunction with SL4A.

Method 4: Cross compile Python source for Android ARM

If you wish to have full fledged Python on Android, why not port it to run on ARM devices like Android? Check the extensive guide here.

Method 5: Pygame

Pygame is a framework for creating Android based games using Python. Checkout the project details.

Know a better way? let us know in comments. We will include them and give credit.

We write latest and greatest in Tech GuidesAppleiPhoneTabletsAndroid,  Open Source, Latest in Tech, subscribe to us @geeknizer OR on Facebook FanpageGoogle+

VN:F [1.9.22_1171]
Rating: 8.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Run Python apps, Scripts on Android, 8.0 out of 10 based on 1 rating

Related Posts

Bookmark and Promote!

© 2014 Geeknizer. All rights reserved. XHTML / CSS Valid.
Designed by taranfx.