1. Start the server
On device
First connect the device to USB. Then, for remote debugging, you need to start the server on your device:
SL4A -> Interpreters -> Menu -> Start Server
Private is preferred.
Then you can see the port for the server in the Android notification area (with SL4A r5 you can specify a fixed port in the settings).
From PC
Alternatively, you can start the server from a PC using adb using a specific port (r5 required to install the port):
$ adb shell am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER \ -n com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher \ --ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT 51943
2. Specify the connection
Now you need to forward your port using adb (assuming the search value is 51943):
$ adb forward tcp:51943 tcp:51943 $ export AP_PORT=51943
3. Start the script
After that, you can run the script locally:
$ python my_script.py
Wifi connection
If you want to go over Wi-Fi, you do not need to forward the port using adb . Instead, you should use a public server and optionally specify your host:
$ export AP_HOST=192.168.0.100
References
For more information, see the Wiki page that addresses this section .
schlamar
source share