1. Download our Official Android App: Forums for Android!

Apps SD card required?

Discussion in 'Android Development' started by ProjectLiquid, Jan 15, 2014.

  1. ProjectLiquid

    ProjectLiquid Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    95
    Joined:
    Jan 14, 2014

    Jan 14, 2014
    95
    10
    38
    Senior QA Tester, Activision
    Galactic Layline
    Hey, just started learning the ropes for android and ran across this issue yesterday.

    Does the phone that you can connect to your computer
    require the phone to have an SD card in it for it to work as a dev phone?

    Meaning, there is currently no SD card in the device. So when I connect device to the computer via USB. Windows (XP) will recognize that the phone is connected but in the file tree, clicking the plus button next to E:drive shows an empty space. I will also receive the warning "Please insert disk into drive E:" when trying to open drive E:

    Btw, phone is an older HTC Evo. I reset to factory defaults with no SD card installed. So there is space on the phone, I'm also just wondering if there is a way to bypass needing an SD card and just use the phone's memory?
     

    Advertisement

  2. Rukbat

    Rukbat Android Expert
    Rank:
    None
    Points:
    843
    Posts:
    10,392
    Joined:
    Jan 16, 2012

    Jan 16, 2012
    10,392
    2,894
    843
    Male
    Being retired and writing Tasker tasks.
    Fayetteville, NC, USA
  3. ProjectLiquid

    ProjectLiquid Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    95
    Joined:
    Jan 14, 2014

    Jan 14, 2014
    95
    10
    38
    Senior QA Tester, Activision
    Galactic Layline
  4. JVene

    JVene Well-Known Member
    Rank:
    None
    Points:
    63
    Posts:
    83
    Joined:
    Jan 2, 2014

    Jan 2, 2014
    83
    91
    63
    For the most part, yes - you simply have to try things and search for specific work arounds.

    As a developer you need a device that supports ADB connectivity, and you need variety.

    You may be well served by downloading genymotion, becoming familiar with AVD and learning to experiment with shell commands, possibly script development.

    You probably must root the device for development. If, for a short time, you don't have access to a shell through ADB, you can grab a terminal emulator for Android to jumpstart your process - you basically have a shell on the device with that, and can proceed to arrange things as you require.

    For example (and this is slightly advanced usage):

    If the device has a little room, you can emulate an SD card on a device that doesn't have one.

    If I assume you have a shell on a rooted device (two requirements here), you can look into these commands...

    dd if=/dev/zero of=output_file bs=32768 count=100

    This command can be used to start the process of creating a virtual disk. This dd example creates a file of zeros 3276800 bytes long. Adjust count to your requirements.

    Note that "output_file" should be a full path to a place on your device that can store a file for your use - each device is different, but you might look in /mnt, /storage, /sdcard0, /sdcard....wherever your device mounts "/data/media" - representing the internal SD card nearly every device has.


    mknod /dev/block/fake_sd b 7 101

    For this to work you may have to first

    mount -o remount,rw /

    The mount command simply allows you to write to the root directory and it's direct children - without it the mknod command might refuse because it's read only.

    mknod makes a node - a special type of file representing a block device (the b parameter here), with id numbers 7 and 101. Google to learn more.

    losetup /dev/block/fake_sd output_file

    This command attaches the node to the file created by dd - note that output_file should be replaced with a full path to the file created by dd.

    At this point /dev/block/fake_sd looks like an SD card without a filesystem, to Android anyway.

    So, format it with

    mkfs.vfat /dev/block/fake_sd

    This writes to output_file, since it's connected to /dev/block/fake_sd as a block device, creating a FAT32 filesystem, just like a real external SD card (a small one).

    Now, mount it....

    Every device has it's own mounting point which differs. On some it's /storage, others it's /mnt (genymotion, for example, uses mnt).

    Again, you may require

    mount -o remount,rw /

    Or something to that effect in order to create a directory inside there, such that:

    mkdir /mnt/sdcard1

    creates an empty directory in /mnt called sdcard1.

    Then, finally,

    mount -o rw -t vfat /dev/block/fake_sd /mnt/sdcard1

    At that moment, /mnt/sdcard1 LOOKS like a vfat filesystem mounted as an external_SD card.

    Assuming your implementation of Android wants it's SD card mounted on /mnt/sdcard1.

    Some might want, instead, something like:

    /storage/external_SD

    Whatever it prefers.

    On most, if the device has no card installed, the directory is already there, just not mounted (and empty). You can simply use it because it's on an ext4 or ext2 filesystem (a Linux filesystem), and the OS knows it's just waiting for a mount.
     
    ProjectLiquid likes this.
  5. ProjectLiquid

    ProjectLiquid Well-Known Member
    Thread Starter
    Rank:
    None
    Points:
    38
    Posts:
    95
    Joined:
    Jan 14, 2014

    Jan 14, 2014
    95
    10
    38
    Senior QA Tester, Activision
    Galactic Layline
    wow, that was more info than I required thanks for sharing :) I think however, that this method is just way to much work for something this simple.
    (Not that I don't mind being shown another way to do something)

    I will probably just find or buy another SD card. I figured that you could find a way to emulate the SD card on the device somehow.

    Basically it seems if the device is to be used for development, some form of an SD card (emulated or real) is required.
     

Share This Page

Loading...