How to install SD card on Android emulator (1.6)

后端 未结 5 1832
走了就别回头了
走了就别回头了 2021-01-06 02:58

I want to install SD card on android emulator(1.6). I am using Eclipse 3.4.0

I found one command to install SD card:

mksdcard

But where to execute

相关标签:
5条回答
  • 2021-01-06 03:29

    You can use the android tool, a command-line utility available in the SDK/tools/ directory.

    Here's a complete tutorial on how to do this.

    0 讨论(0)
  • 2021-01-06 03:32

    If you are using Eclipe, just click on the Android Device Manager icon, then click on the Android Device Manager tab, if you've already create an AVD just select it, then click on the "Edit Button" on the right side, then locate where SD Card is then change size to you prefer number "e.g: 256 or 512 or 1024" and make sure that you have enough "Internal storage capacity", then click on the "OK" button. Now go to the "Run Configuration" and start your AVD emulator, in the setting of AVD you should see that your SD Card is "Mounted".

    This should work.

    If you want to add a file or folder into your SD Card just do the following:

    steps:

    1) Open your Android application's source code file with a text or programming editor. 2) Browse to the location in the source code where you wish to call the function that writes a file to the device's external storage. 3) Insert this single line of code to check for the SD card:

    File sdCard = Environment.getExternalStorageDirectory();
    

    4) Insert these lines of code to set the directory and file name:

    File dir = new File (sdcard.getAbsolutePath() + "/folder1/folder2");
    dir.mkdirs();
    File file = new File(dir, "example_file");
    

    5) Replace "/folder1/folder2" in the above code with the actual path where you intend to save the file. This should be a location in which you normally save your application files. Also, change the "example_file" value to the actual file name you wish to use.

    6) Insert the following line of code to output the file to the SD card:

    FileOutputStream f = new FileOutputStream(file);
    

    Finally step 7:

    Save the file, then compile it and test the application using the Android emulator software or the device.

    This will works!!! ;-)

    0 讨论(0)
  • 2021-01-06 03:41

    I create all my virtual devices through the dialog in Eclipse. Window > Android SDK and AVD Manager > New (button). It has input controls for SD card specs.

    0 讨论(0)
  • 2021-01-06 03:41

    From the command line you can do the following Go to the /tools folder of the sdk

    Create Android profile with SD card

    android.bat create avd -n jonas2 -t 1 -c 256M
    

    Start Emulator

    emulator.exe -avd jonas2
    
    0 讨论(0)
  • 2021-01-06 03:54

    this easiest way to make sure your sd card is properly associated to your emulator instance is to create an AVD with an SD card. Do it as follows : in Eclipse: Window=> android SDK and AVD manager=>New :

    -give a name to your AVD (no space allowed)
    -give a SDK target
    -give size to the wanted SDcard
    -create the new AVD

    Or, 2nd solution, you already have your own AVD and you want to add a SD card to it: open a command prompt or terminal (windows/ linux?) cd to your sdk/tools directory execute the following :
    mksdcard 256M NameOfYourCard
    (you can pass the size you want ofc)

    and then, put the following in you run configuration in the "Launch Additional command line" field :

    -sdcard fullPathToYourCard

    It should work. If it's not clear, have a look in here for more detailled procedure

    0 讨论(0)
提交回复
热议问题