DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Results 1 to 5 of 5

Thread: App access to sdcard while in Eclipse debug?

  1. Droid Newbie
    chasmopolitan's Avatar
    Member #
    114939
    Join Date
    Sep 2010
    Location
    Eagle, Idaho
    Posts
    4
    Phone
    DROIDX
    #1

    App access to sdcard while in Eclipse debug?

    I would like my app to be able to open a file on the sdcard at:
    /sdcard//SmartRotor/ExampleZlog.txt

    The following method:

    public StreamProcessor()
    {
    System.out.println(filePath);
    try {
    fileReader = new FileReader( filePath );
    } catch (FileNotFoundException e) {
    System.err.println(e);
    }
    bufferedSmartRotorStream = new BufferedReader( fileReader );
    }

    displays logcat entries:

    INFO/System.out(28609): /sdcard//SmartRotor/ExampleZlog.txt
    WARN/System.err(28609): java.io.FileNotFoundException: /sdcard/SmartRotor/ExampleZlog.txt

    I notice when the DroidX is attached via the USB cable the Android Files manage cannot access the sdcard (probably owing to its being mounted on the laptop). I assume that is the reason I can't open the file from the app.

    Is there some incantation I'm missing that would permit
    fileReader = new FileReader( filePath );
    to an /sdcard/-based file path?

    Newbie,
    -chas-
  2. Super Moderator/RS
    mwhartman's Avatar
    Member #
    27806
    Join Date
    Jan 2010
    Location
    South FL
    Posts
    10,730
    Liked
    40 times
    Phone
    Moto Droid
    Premium Member
    #2
    Most of the code you supplied is above my pay grade. I have a rooted Droid and when connected to my computer the SD card can only be accessed via the computer.

    Mike
  3. Droid Newbie
    chasmopolitan's Avatar
    Member #
    114939
    Join Date
    Sep 2010
    Location
    Eagle, Idaho
    Posts
    4
    Phone
    DROIDX
    #3
    Thanks, Mike. I think that confirms my suspicions that the Eclipse USB-mount makes /sdcard inaccessible from the device. Unless there's some other Linux-like incantation by which the /sdcard can be shared and mounted by both the local and the remote. I guess I'll have to live with that restriction for now.

    You wouldn't by any change know how to create an /sdcard location for an Android Virtual Device(VD)?

    -chas-
  4. Super Moderator/RS
    mwhartman's Avatar
    Member #
    27806
    Join Date
    Jan 2010
    Location
    South FL
    Posts
    10,730
    Liked
    40 times
    Phone
    Moto Droid
    Premium Member
    #4
    Sorry, I do not know how to configure.

    Mike
  5. Droid Newbie
    chasmopolitan's Avatar
    Member #
    114939
    Join Date
    Sep 2010
    Location
    Eagle, Idaho
    Posts
    4
    Phone
    DROIDX
    #5

    Cool Add directory structure and files to emulator /sdcard

    For posterity, here's what worked for me:

    On Windows Vista; fire up a command window (I have a desktop shortcut "%SystemRoot%\system32\cmd.exe")
    cd "C:\Program Files\android-sdk-windows\tools"
    mksdcard -l DroidXcard 500M C:\Users\<user>\.android\avd\Android7.avd\sdcard_v 7
    Run Eclipse and open project. Then:
    Run -> Debug Configurations...->Android Application->"Target"<tab>
    You may have to resize the "Debug Configurations" window by dragging the lower border down to expose the "Additional Emulator Command Line Options" field.(!) Enter the file path to the sdcard image:
    -sdcard "C:\Users\<user>\.android\avd\Android7.avd\sdcard_ v7"
    Within Eclipse, Run debug (F11), and go the DDMS view (tab labeled "DDMS" in upper right-hand corner of Eclipse window). In that view find the "File Explorer"<tab> which should show an \sdcard directory. *And* you should be able to enter the directory. If you can't you haven't properly created or loaded the mksdcard image. Note: You'll get cryptic "permission"-related messages.

    Terminate Eclipse debug session (<cntl>+F2). This leaves the AVD/emulator running and disconnects Eclipse from it.

    Again, from a command window in Windows Vista:
    cd C:\Program Files\android-sdk-windows\tools
    adb -e shell -- fires up a shell on the emulator
    cd sdcard -- puts you in the main directory of the sdcard image you created with mksdcard
    mkdir <myProjectDir> -- use to create any directory structure you need
    exit -- leave the shell
    Run Eclipse again and open project. Run debug (F11), and go the DDMS view. Using the Eclipse DDMS "File Explorer"<tab>, descend to the directory in /sdcard you want. In the upper right-hand corner of the "File Explorer"<tab> find icons for "Pull a file"... and "Push a file".... Use the latter to move a file from your Windows file system into the emulator's \sdcard file space.

    There may be better ways, but for this newbie, it worked.
    -chas-

    P.S. Why go to such lengths when you have a real DroidX? Because when you connect your device via USB, Windows auto-mounts the \sdcard directory depriving your device-resident app of access... <grumble>.

Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. about:debug broken (1.1 and froyo)
    By tameone in forum Bugless
    Replies: 8
    Last Post: 06-11-2010, 11:44 AM
  2. [ HOW TO ] access data backed up via Nandroid to your SdCard
    By Flomaster in forum Android Hacks and Help
    Replies: 6
    Last Post: 02-12-2010, 10:44 AM
  3. Replies: 8
    Last Post: 01-22-2010, 12:39 AM
  4. Debug info from shell commands
    By shpen in forum Android Hacks and Help
    Replies: 1
    Last Post: 11-20-2009, 08:24 PM
  5. Bootloader/Debug/Programming mode with LG charger
    By Erron in forum Android Hacks and Help
    Replies: 11
    Last Post: 11-20-2009, 10:37 AM

Search tags for this page

accessing the device's sd card in android in eclipse

,

android cannot browse sdcard from eclipse ddms

,

android eclipse access sd card

,

android eclipse ddms can't access sdcard

,
android eclipse ddms mount sd card
,

android eclipse debug mount sd card device

,

android eclipse debug sdcard

,

como debugar app no sdcard

,

eclipse how to acccess sd card

,
how to open sd card in android virtual device
Click on a term to search our site for related topics.
Find us on Google+