0
votes

Objective: Trying to run SL4A facade APIs from python shell on the host system (windows 7 PC)

My environment: 1. On my windows 7 PC, i have python 2.6.2 2. Android sdk tools rev 21, platform tools rev 16 3. API level 17 supported for JB 4.2 4. I have 2 devices ( one running android 2.3.3 and another android 4.2.2) both running Python for android and SL4A

I'm trying these commands as specified at http://code.google.com/p/android-scripting/wiki/RemoteControl

Here are the commands which i'm trying on the python shell:

Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

>>> import android  
>>> droid=android.Android  
>>> droid.makeToast("Hello")  

Traceback (most recent call last):
File "", line 1, in
AttributeError: type object 'Android' has no attribute 'makeToast'

Before this i'm performing the port forwarding and starting a private server as shown below

$ adb forward tcp:9999 tcp:4321  
$ set AP_PORT=9999   

Also set the server on the target listening on port 9999 ( through SL4A->preferences->serverport.

Please help to understand where i'm doing mistake which gives the above error while trying droid.makeToast("Hello") ?

2

2 Answers

0
votes

Try

import android
droid=android.Android()
droid.makeToast("Hello")

(you are missing parentheses after android.Android)

0
votes

Hope you solved the problem. This is what I found, so maybe for somebody else it will be useful. You need to run all your commands inside the DOS shell...otherwise you will get that error[11001]. If you still want to run you commands outside the DOS shell - add a new environment variable as described here: http://www.smartphonedaq.com/installation.page