Android apps with Python and sl4a: Building your own development environment

Source: Internet
Author: User
Keywords Applications PYTHON SL4A
Tags android android apps android platform applications apps can find click code

A common misconception about developing on Google's Android platform is that you must write code in the Java™ language. In fact, you'll have a variety of options with scripting Layer for Android (SL4A) project. SL4A first was a project that completed 20%, and was developed by Google employee Damon Kohler. It took almost 2 years, with 4 major versions.

SL4A provides a platform for many scripting languages, including Lua, Perl, Python, and Rhino. It also supports base Shell scripting. Now the python portion of the SL4A project has evolved into a stand-alone project, in part because of the popularity of Python and the need to detach new Python functions from the main sl4a version cycle.

This article focuses on using Python to write applications for the Android platform. Python is a http://www.aliyun.com/zixun/aggregation/17547.html "> powerful tool that can write simple scripts and complex multithreaded applications. The biggest advantage of using Python on Android is the opportunity to use thousands of lines of code that have been written, and that code is free. Python is an easy to learn language, and if you've never used it before, you can find a lot of resources on the Internet to help you get started as quickly as possible.

Installation and Setup

Before you start using sl4a for development, you must download and install several prerequisite tools. The first is the complete Java Development Kit (JDK). You can find the latest version of the tool on the Oracle Developer Web site.

Second, you need to download the Android Software Development Kit (SDK). There are two formats available for download on the Android Developer main site: A. zip file and an. exe file. If you download and run the. exe file, an interface appears, asking you to select the SDK version and the supporting files you want to install (see Figure 1).

Figure 1. Select the Android SDK option you want to download

For this article, I am installing and testing on the Windows®7 64-bit machine.

Because this article is about using Python to develop applications for the Android platform, you obviously need to install Python on the development machine. Windows itself does not take Python. At the time this article was written, the sl4a Python version was 2.6.2. You can download the 32-bit or 64-bit version of Python 2.6 to remain compatible.

Adding some Android SDK links to your PATH statement is a good idea, making it easier to start SDK Manager and other tools. To do this on Windows 7, perform the following steps:

Press the Windows key and click Search. In the Text dialog box, enter Environnement. Click Edit the system environnement variables. In the open window, click Environnement Variables, and then select the PATH variable in the User Variables list. Click Edit, and then add the path to your Android SDK tools directory.

You need to add the following string:

; C:\Users\paul\Downloads\android-sdk-windows\platform-tools

Before you add a new path to a new directory, you must add a semicolon (;). When the input is complete, click OK 3 times.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.