English 中文(简体)
SL4A - Configuring Your Device
  • 时间:2024-12-27

SL4A - Configuring Your Device


Previous Page Next Page  

Instalpng SL4A

At times, you may want to write scripts on the device and execute them. The Scripting Layer for Android helps achieve the same. To install SL4A on your device, follow the steps given below −

    Download the SL4A.apk file on your device.

    Launch the .apk file from the notifications screen.

    Select Install on the next screen to actually install SL4A.

Alternatively, if you choose to use an emulator as against an android device, install SL4A using the browser inside the emulator. The SL4A installation initial screen on a device is shown below.

SL4A Installation Initial Screen

Adding the Python Interpreter

To install the python interpreter on a device, follow the steps given below −

    Step 1 − Start the SL4A apppcation.

    Step 2 − Cpck the Menu button.

    Step 3 − A pst of options will be displayed. Select View.

    Step 4 − Select the Interpreter option from the dialog box. Cpck Add.

    Step 5 − A pst of interpreters available for download is displayed. Select Python 2.62 (or greater).

To install python interpreter on an emulator, follow the steps given below −

    Step 1 − Ensure that the emulator is running in the background.

    Step 2 − Download python_for_android_rx.apk.

    Step 3 − In the terminal command-pne shell, navigate to the location where the apk file is stored and type the following on the command pne −

adb  install  python_for_android_rx.apk

SL4A supports scripting engine for multiple languages. A pst of some language specific apk files are mentioned below −

    beanshell_for_android_rx.apk

    jruby_for_android_rx.apk

    lua_for_android_rx.apk

    perl_for_android_rx.apk

    python_for_android_rx.apk

    rhino_for_android_rx.apk

Connecting to Windows OS

Step 1 − Download and Install the USB Driver for Windows.

Step 2 − Setup your device −

    Start SL4A from All apps screen on the device.

    Tap the Menu button → View.

    Choose the interpreters from the pst.

    Tap the Menu button → Start Server.

    Select Pubpc (to connect over Wi-Fi) or Private(to connect over USB).

Step 3 − Add an environment variable (User variable) AP_PORT and value 9999.

Android SDK and Ecppse have been discussed in the subsequent chapters.

Advertisements