Up to higher level directory | |||
Name | Date | Size | |
---|---|---|---|
Android.mk | 21-Oct-2016 | 709 | |
Common/ | 21-Oct-2016 | ||
Docs/ | 21-Oct-2016 | ||
InterpreterForAndroid/ | 21-Oct-2016 | ||
README.md | 21-Oct-2016 | 2.2K | |
ScriptingLayer/ | 21-Oct-2016 | ||
ScriptingLayerForAndroid/ | 21-Oct-2016 | ||
Utils/ | 21-Oct-2016 |
1 Scripting Layer For Android 2 ============================= 3 4 ### Introduction 5 Originally authored by Damon Kohler, Scripting Layer for Android, SL4A, is an automation toolset 6 for calling Android APIs in a platform-independent manner. It supports both remote automation via 7 ADB as well as execution of scripts from on-device via a series of lightweight translation layers. 8 9 ### Build Instructions 10 Due to its inclusion in AOSP as a privileged app, building SL4A requires a system build. 11 12 For the initial build of Android: 13 14 cd <ANDROID_SOURCE_ROOT> 15 source build/envsetup.sh 16 lunch aosp_<TARGET> 17 make [-j15] 18 19 *where <ANDROID_SOURCE_ROOT> is the root directory of the android tree and <TARGET> is the lunch 20 target name* 21 22 Then Build SL4A: 23 24 cd <ANDROID_SOURCE_ROOT>/external/sl4a 25 mm [-j15] 26 27 ### Adding SL4A Builds to Android Builds by Default 28 1) If you are not using a custom buildspec, create one as follows: 29 30 cp <ANDROID_SOURCE_ROOT>/build/buildspec.mk.default <ANDROID_SOURCE_ROOT>/buildspec.mk 31 32 2) Modify the buildspec to build SL4A as a custom module by editing 33 the line '#CUSTOM_MODULES:=' to 'CUSTOM_MODULES:=sl4a': 34 35 sed -i 's/#CUSTOM_MODULES:=/CUSTOM_MODULES:=sl4a/' <ANDROID_SOURCE_ROOT>/buildspec.mk 36 37 ### Install Instructions 38 Run the following command: 39 40 adb install -r <ANDROID_SOURCE_ROOT>/out/target/product/<TARGET>/data/app/sl4a/sl4a.apk 41 42 ### Run Instructions 43 a) SL4A may be launched from Android as a normal App; or 44 b) To enable RPC access from the command prompt: 45 46 adb forward tcp:<HOST_PORT_NUM> tcp:<DEVICE_PORT_NUM> 47 adb shell "am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER \ 48 --ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT <DEVICE_PORT_NUM> \ 49 com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher" 50 *where <HOST_PORT_NUM> and <DEVICE_PORT_NUM> are the tcp ports on the host computer and device.* 51 52 ### Generate the API Documentation 53 From SL4A source directory run this command: 54 55 perl Docs/generate_api_reference_md.pl 56 57 In the Docs directory there should now be an ApiReference.md file that 58 contains which RPC functions are available in SL4A as well as documentation 59 for the RPC functions. 60 61