Jump to content


Photo

Chapter 8 - Issue Uploading Script


  • Please log in to reply
3 replies to this topic

#1 AntonyL

AntonyL

    New Member

  • Members
  • Pip
  • 4 posts

Posted 03 July 2011 - 11:53 AM

Hi

Head First books are fantastic and a pleasure to work through. I have enjoyed the Python book right up to the app bit where I can't seem to copy my python script onto the virtual Android device.

On chapter 8 I am struggling with this:

adb push mydroidtest.py /sdcard/sl4a/scripts

It may be because I don't have /sdcard on my computer but please see below for more debug details.

Thanks for your attention.



Antonys-MacBook-Air:android-sdk-mac_x86 antonylewis$ ls
SDK Readme.txt mydroidtest.py platforms temp
add-ons platform-tools samples tools
Antonys-MacBook-Air:android-sdk-mac_x86 antonylewis$ platform-tools/adb push mydroidtest.py /sdcard/sl4a/scripts
error: device not found



Antonys-MacBook-Air:android-sdk-mac_x86 antonylewis$ echo $PATH
/Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/antonylewis/Coding/android-sdk-mac_x86/tools

I can't find /sdcard on my computer:

Antonys-MacBook-Air:platform-tools antonylewis$ cd /
Antonys-MacBook-Air:/ antonylewis$ ls
Applications bin private
Library cores sbin
Network dev tmp
System etc usr
User Guides And Information home var
Users mach_kernel
Volumes net


Please advise! I'd love to finish this book :)

Many thanks

Antony

#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 03 July 2011 - 12:28 PM

Hi.

This has nothing do with your computer's hard disk, and everything to do with the emulator. The /sdcard is a device on the emulator. Note that the emulator needs to be up-and-running to receive the file you are sending with your "adb" command.

Now, having said that, the location that the Python for Android tools use to store scripts on the phone may have changed recently - the toolkit is under constant review and, as such, the location that worked for me 12 months ago (namely, /sdcard/sl4a/scripts) may no longer work. You can check the on-line documentation for the sl4a project to see if things have changed. Also, be careful with the "sl4a" bit of the name... that's a letter "l" before 4, not the number one (1).

I hope this helps you get back on track - great to see you enjoying the book.

--Paul.

#3 AntonyL

AntonyL

    New Member

  • Members
  • Pip
  • 4 posts

Posted 07 July 2011 - 06:25 AM

Hi Paul

Many thanks for your reply. I deleted the emulator and made a new one, and followed the instructions again from the book, this time downloading the same versions that were mentioned in the book (specifically downloading python_for_android_r1.apk instead of the most recent which was r4 which I did last time).

This time it worked. The only difference from the instructions was using platform-tools/adb instead of tools/adb.

Again thanks for your speedy reply. I've been recommending Head First books to everyone!

Regards

Antony

#4 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 07 July 2011 - 02:11 PM

That's great! Thanks for sticking at it (and for the kind words). Regards. --Paul. :-)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users