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

Thread: [How To] Guide to using the AVD Emulator (SDK)

  1. Master Droid
    TheSwaggeR's Avatar
    Member #
    159353
    Join Date
    Jan 2011
    Posts
    744
    Liked
    2 times
    Phone
    Motorola Droid 2 2.3.20.A955
    #1

    [How To] Guide to using the AVD Emulator (SDK)

    This will be my first, and more to come, guide in explaining how to set up the mysterious SDK and AVD Manager Emulator and using it to adb push and remove files, theming test, APK test and much more.

    NOTE: This is WINDOWS set up only. Using SDK and AVD Manager. I'm currently on Windows Vista 32 bit 86x. I have not tested it on other machines nor will I test it on other machines. This set up may work on other machines but this is my set up to help get those of you to understand the basics and getting it started.

    Requirements: (NOTE: Please download in following order!)

    Latest version of Java java.com: Java + You (Java version 6 update 24 is latest at the start of this thread)

    Latest version of JDK Java SE Downloads (JDK version Java SE Development Kit 6u24 is latest at the start of this thread) Press on the DOWNLOAD JDK button at that link.

    Android SDK and AVD Manager Android SDK | Android Developers (installer_r10-windows(Recommended) ) Please download only the Recommended one for the time being.

    Setting Up Java, JDK, and SDK And AVD Manager:

    Install Java and then JDK onto your system. Please do not change the name of the folder(s) in the installation process. Allow it to install into the one it comes up with.

    You will probably have older versions of Java and possibly JDK (if you did JDK work before). You will need to allow Java and JDK to remove the older versions and install the new versions. If something goes wrong, then post your problem and I may have a solution to help you out as I too have faced a couple of installation problems with corrective work-arounds.

    After completing these 2 installations you may have to restart your computer. Do so for the changes to be made.

    Next, install SDK And AVD Manager. You will be prompted to change the whereabouts this gets installed into. Change the target folder to C:\androidsdk You can change androidsdk to a different name if you wish, but I chose androidsdk just to make it short and noticeable on my C:\ drive. Proceed to install SDK And AVD Manager.

    Next, go to your androidsdk (or whatever you named it) folder and you will see SDK Manager with the little android icon to the left of it. Click on it and allow everything to set up. Select on Available Packages, select the packages you want to install and then click on Install Selected. If Choose Packages screen comes up automatically then click on Accept All and click on Install. This may take a bit so go read the news on CNN or something till it is done.

    Next step: Environment Variables

    Environment Variables: (Note: Java, JDK, and SDK And AVD Manager will not work together if you do not establish variables for these)

    (thanks to: xKape for variable establishments in http://www.droidforums.net/forum/tea...ow-basics.html)

    On your Windows screen, click on Start, right click Computer (or My Computer), click on Properties, click on Advanced system settings on left side, you will be prompted by Windows for permission and click OK, if you aren't on the Advanced tab the please click on that tab, click on Environment Variables and do as following:

    User variables for YourName:

    click on new

    Variable name: adb
    Variable value: C:\androidsdk\platform-tools\adb

    click ok

    System variables:

    scroll down to Path
    double click on Path or you can just click Edit button

    This is what mine looks like:

    %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Sy stem32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\QuickTime\QTSystem\;%SYSTEMROOT%\System32\Wi ndowsPowerShell\v1.0\;C:\Program Files\Java\jre6\bin;C:\Program Files\Java\jdk1.6.0_24\bin;C:\androidsdk\platform-tools;C:\androidsdk\tools

    Note:
    the lines I bolded are what you need to put in the variables. You will probably have to change according to your folder structure. Make sure Java's bin and JDK's bin are targeted as shown. Please make sure you edit as it show on your folder structures, otherwise it will not work. You can use my example to make sure the structured folders are covered.

    Note: in c:\androidsdk\tools folder it may have a file that is named adb_has_moved you will need to download this:

    MEGAUPLOAD - The leading online storage and file delivery service

    and extract to c:\androidsdk\tools

    this will provide a working adb.exe, AdbWinApi.dll, and AdbWinUsbApi.dll for use in your tools folder.

    After establishing variables click on Ok, click on Ok again. Save any unsaved work and then close all programs and restart your computer.

    You should have everything established by then. Let's run some test...

    Open up your Command Prompt (can be found in Start>All Programs>Accessories>Command Prompt. Or just pushing Winkey+R and type cmd)

    In Command Prompt type this:

    java -version

    it should say something like this after entering it:

    java version "1.6.0_24"
    java<TM> SE Runtime Environment <build 1.6.0_24-b07>
    Java HotSpot<TM> Client VM <build 19.1-b02, mixed mode, sharing>

    Next, type this:

    javac -version

    it should say something like this after entering it:

    javac 1.6.0_24

    If you see those 2 lines then you're all set! These lines are basically echoing to java for version and build to see if it exist. Exit out of Command Prompt or type exit and then enter.


    Next, we will be setting up the Emulator. This can be very tricky, so trial and error are the concept of learning to get it to work properly. Please feel free to post some issues and I may be able to help you solve the problem.

    1: open up Android SDK And AVD Manager (remember its in androidsdk or whatever folder you named it. it should also be on Start>All Programs>Android SDK Tools> SDK Manager
    2: Click on Virtual Devices in the left pane
    3: Click on New... on the right side. A big box will come up. We will do just basic info on it just to get started and learn from

    Name: you will name your AVD and it can be whatever you want. Example: EmulatorProject_v1
    Target: this is the difficult part. we want to keep up with the current version of what platform our Android Device is running on. I go back and forth on Android 2.3.3 - API Level 10 and Android 3.0 - API Level 11. This part is also crucial because you will need to use the right system.img for both platform. So pick one of these and stick with it for now. We will get to the system.img in a bit.
    SD Card: this option is also crucial which helps your emulator be able to build on. without this you will get "No SD Card found" errors. We will stick to Size for the time being. I would recommend it to be in MiB rather than KiB (MiB is megabyte and KiB is kilobyte). Minimum MiB is 9, if you push MiB to be over 500 you will have a sluggish machine and a very long waiting period for everything to load up. So, stick to 100 to 500 MiB for safe range.
    Snapshot: check box to enable it
    Skin: use built-in default for now
    Hardware: you will see a few selections coming up after entering info stated from above. It is imperative you click on the New... button. We need SD Card Support in order for our SD Card's hardware to function properly.

    When finished, click on Create AVD. It will then begin to create the AVD Emulator and it will save into your C:\Users\Your Name\.android\avd\YourEmulatorName

    Exit out of the Android SDK And AVD Manager. Let's go get the rest of the Emulator running.

    4:
    We need to copy system.img to C:\Users\Your Name\.android\avd\YourEmulatorName folder by doing this, you need to remember what platform you chose when you made your AVD. Here's the 2 locations according to whichever platform you chose:

    if it is...

    Android 2.3.3 - API Level 10:

    go to c:\androidsdk\platforms\android-10\images folder and right click on system and click on Copy

    now go to c:\Users\Your Name\.android\avd\YourEmulatorName folder and then right click anywhere in that folder and click paste. You should see a system.img file get pasted in there. Minimize your folder for now.

    if it is...

    Android 3.0 - API Level 11:

    go to c:\androidsdk\platforms\android-11\images folder and right click on system and click on Copy

    now go to c:\Users\Your Name\.android\avd\YourEmulatorName folder and then right click anywhere in that folder and click paste. You should see a system.img file get pasted in there. Minimize your folder for now.

    5: Let's download these 2 files:

    Vending.apk: Vending.apk

    GoogleServicesFramework.apk
    GoogleServicesFramework.apk

    6: Put both Vending.apk and GoogleServicesFramework.apk into c:\androidsdk\tools folder

    7: Open up Command Prompt (make sure you right click Command Prompt before opening and click Run as Administrator)

    type the following lines:

    cd c:\androidsdk\tools (hit enter)
    emulator -scale .75 -avd youremulatorname -partition-size 128 (hit enter)

    This will launch your emulator. The use of -scale .75 redefines the screen size. If you do not include -scale then you will have an oversized emulator. Also note this, if you use partition size 96 you may get "Out of memory" errors. Try to keep partition size at 128 for stablization.

    Note: Please wait till your Emulator is fully running and you see the home screen and everything is loaded up before proceeding to step 8.

    8: Launch another Command Prompt. Make sure you keep your original Command Prompt open still.

    type the following lines:

    cd c:\androidsdk\tools (hit enter)
    adb -s emulator-5554 shell (hit enter)
    mount (hit enter)

    Look for this line:
    /dev/block/mtdblock0 /system yaffs2 ro 00

    type the following lines:

    mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
    (hit enter)
    chmod 777 /system/app (hit enter)
    exit (hit enter)

    Once you typed exit it should go back to c:\androidsdk\tools

    Note: You may need to replace 5554 with your emulator serial number. Just look at the top of your running emulator for the serial number to replace. If it is 5554 then use 5554, if not, then change it before you use the adb line shown above.

    9: ADB pushing to your /system/app Emulator. We will be pushing Vending.apk and GoogleServicesFramework.apk to /system/app section.

    On your Command Prompt you were just on type the following lines in:

    adb -s emulator-5554 push Vending.apk /system/app/. (hit enter)

    Note: yes there is a PERIOD (.) after /system/app/. <----- when entering in that line

    If adb push is successful you should see a single line showing how fast it pushed the APK. Like this:

    198 KB/s <780456 bytes in 3.845s>

    type in the following lines:

    adb -s emulator-5554 push GoogleServicesFramework.apk /system/app/.

    If adb push is successful you'll see similar results

    10: We need to remove a couple of files:

    SdkSetup.apk from /system/app if not removed then your SDK will be restored right back to the beginning in a new session.

    type in the following lines in Command Prompt you were just using:

    adb shell rm /system/app/SdkSetup.apk (hit enter)

    It will now be removed.

    11: Close your Emulator
    12: Go to your c:\Users\Your Name\.android\avd\YourEmulatorName folder and delete these 2 files:

    userdata-qemu.img
    cache.img

    13: All finished! Now you can launch your Emulator from the Android SDK And AVD Manager by click on your Emulator name and then click on the Start button.

    Side Notes:

    You can continue to push new APK(s) on top of the existing APK on your Emulator. I have been running test for a pull but apparently that is not necessary to do an adb pull. If you need to get rid of the APK for error issues then I recommend this:

    type in the following lines:

    cd c:\androidsdk\tools (hit enter) (if you are not in this path then you need to be)
    adb shell rm /system/app/NameofAPK.apk (hit enter)

    To replace with a fresh APK or existing working APK work:

    type the following lines:

    adb -s emulator-5554 push NameofAPK.apk /system/app/. (hit enter and you will have a fresh original APK in the emulator)

    If you have any questions, just leave a post here and I'll be around to answer what I can.


    ***Linux Users Please Click Link Below***

    How to Theme With the Emulator

    (thanks to czerdrill for providing the link for Linux users)



    Yes I typed all of this stuff up from compiling a lot of information from resources and research, including conducting test of my own to work the commands together. There are several other different commands to work inside the parameter if you need to do other things. I have those as well. Please feel free to add, or if you see a mistake then let me know.
    Last edited by TheSwaggeR; 03-04-2011 at 08:47 PM.
    Funny how some people complain more than my 2 year old daughter does.
  2. Droid Newbie
    bhbk0103's Avatar
    Member #
    178207
    Join Date
    Mar 2011
    Posts
    2
    Phone
    Enter Current Phone Model Here
    #2

    Android sdk error

    First i want to say your instructions are awesome. Im setting this up for a android 1.6 tablet. The root of my android forld is C:\program files\android\android-sdk\tools. When i can get to step 7 i enter what is in your instruction and hit enter. It loads the emulator 5554 but in the cmd window the last line says NAND: nand_dev_load_disk_state ftruncate failed : Invalid argument. I continue to step 8 and go to the root of tools and what you give in your instruction and get the following daemon not started started daemon started successfully then the last line says error device offline i then enter mount like stated in instructions and it tells me mount is not recognized as an internal or external command operable program or batch file

    Was wondering if you what this ment and if you have a fix or should i try to continue.

    Thanks
  3. Droid Newbie
    bhbk0103's Avatar
    Member #
    178207
    Join Date
    Mar 2011
    Posts
    2
    Phone
    Enter Current Phone Model Here
    #3

    SDK Issues

    Well i had not received any responses so i decided to uninstall everything and reinstall it and this time it worked just fine.

    Now i just have to figure out how to use it.

    Thanks again for the great instruction
  4. Master Droid
    TheSwaggeR's Avatar
    Member #
    159353
    Join Date
    Jan 2011
    Posts
    744
    Liked
    2 times
    Phone
    Motorola Droid 2 2.3.20.A955
    #4
    Quote Originally Posted by bhbk0103 View Post
    Well i had not received any responses so i decided to uninstall everything and reinstall it and this time it worked just fine.

    Now i just have to figure out how to use it.

    Thanks again for the great instruction
    Sorry, I didn't get any alerts that my thread had response in it. My apologies.

    Anyways, it is best to have everything on the root of the C:\ drive. Not in c:\program files\. The reason for this is because when it comes to emulators, adb, java scripts, and the rest of the stuff, it will cause problems with any directories that have a space in their directory name (Ex: C:\Program Files\). It's better off using the root of your C:\ drive to do that so that way it allows you to rename the folder without unreadable characters such as the space between the name.

    Since you have resolved the problem and are looking to find out what to do next, I would practice pushing APK(s) and removing them. Once you get the hang of how things work, then you can try to learn how to edit APK(s), such as xml editing, 9.png's, png's, smali/baksmali, replacing images with original images, and push those APK(s) onto the emulator for test to see how it looks and understand the proper functions of errors that some APK(s) have when not properly zipaligned, optimized, etc and make adjustments to where it works perfectly. Then you can push the newly edited APK(s) to your phone to enjoy.

    There is endless things to do with the emulator. You can even test out a whole theme on it if you wanted to. I'm not sure about flashing a ROM, such as Liberty 1.5, into an emulator. I haven't tried that one yet but it's worth the try.

    Just make sure you research and learn all your command lines to work with the emulator. The command lines contain 100s of useful lines and the base of the Emulator is all about the command lines.

    I'll pay attention to this thread more. If you have more questions then let me know or shoot me a PM.
    Funny how some people complain more than my 2 year old daughter does.
  5. Droid Newbie
    surfdroid's Avatar
    Member #
    182512
    Join Date
    Mar 2011
    Posts
    1
    Phone
    Enter Current Phone Model Here
    #5
    When trying to run the SDK Tools install, I get the following error popup.

    Java SE Development Kit (JDK) not found.
    Android SDK relies on the Java SE Development Kit (JDK).
    Go to Oracle Technology Network for Java Developers > Downloads > Java SE > JDK to download and install a JDK before continuing.
    Note: A Java Runtime (JRE) is not enough to develop for Android.


    At the commande prompt:

    java -version

    java version "1.6.0_24"
    Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
    Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

    javac -version

    javac 1.5.0_06


    I have two previous versions of java installed in this machine.

    Any help on the corrective action to get the SDK to install will be greatly appreciated.

    Thanks,

    Surfdroid.
  6. Super Moderator
    justin82's Avatar
    Member #
    14505
    Join Date
    Dec 2009
    Posts
    3,614
    Liked
    455 times
    Phone
    Razr Maxx
    Premium Member
    #6
    nice write up thanks for the time spent on this..
    "The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself?"


    Razr maxx
  7. Master Droid
    TheSwaggeR's Avatar
    Member #
    159353
    Join Date
    Jan 2011
    Posts
    744
    Liked
    2 times
    Phone
    Motorola Droid 2 2.3.20.A955
    #7
    Quote Originally Posted by surfdroid View Post
    When trying to run the SDK Tools install, I get the following error popup.

    Java SE Development Kit (JDK) not found.
    Android SDK relies on the Java SE Development Kit (JDK).
    Go to Oracle Technology Network for Java Developers > Downloads > Java SE > JDK to download and install a JDK before continuing.
    Note: A Java Runtime (JRE) is not enough to develop for Android.


    At the commande prompt:

    java -version

    java version "1.6.0_24"
    Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
    Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)

    javac -version

    javac 1.5.0_06


    I have two previous versions of java installed in this machine.

    Any help on the corrective action to get the SDK to install will be greatly appreciated.

    Thanks,

    Surfdroid.
    If you have 2 previous versions of JDK then you need to uninstall them and download from the link I provided. Usually when installing something like this they will ask you if it's ok if they remove the older version(s) and install the new version. Just uninstall any previous versions you have and download the latest version from the link I provided.

    Requirements: (NOTE: Please download in following order!)

    Latest version of Java java.com: Java + You (Java version 6 update 24 is latest at the start of this thread)

    Latest version of JDK Java SE Downloads (JDK version Java SE Development Kit 6u24 is latest at the start of this thread) Press on the DOWNLOAD JDK button at that link.

    Android SDK and AVD Manager Android SDK | Android Developers (installer_r10-windows(Recommended) ) Please download only the Recommended one for the time being.
    This is the 3 things you need above. Java, JDK, and Android SDK. Remember, you need to download those in the respective order I stated.

    nice write up thanks for the time spent on this..
    Thank you. It's hard to get the help you need so I'm doing the best I can to break the barriers, and explore, research, test and write up guides so you guys don't have to go to a million sites to find little pieces of answers to put it all together. I'll be cleaning this thread up a bit so it's more readable and more clean.
    Last edited by TheSwaggeR; 03-24-2011 at 10:29 PM.
    Funny how some people complain more than my 2 year old daughter does.
  8. Droid Newbie
    webmasterintexas's Avatar
    Member #
    241263
    Join Date
    Dec 2011
    Location
    Fort Worth Texas
    Posts
    1
    Twitter
    webmasterntexas
    Phone
    Samsung
    #8

    NAND: nand dev load space restore failed...

    Quote Originally Posted by TheSwaggeR View Post
    Sorry, I didn't get any alerts that my thread had response in it. My apologies.

    Anyways, it is best to have everything on the root of the C:\ drive. Not in c:\program files\. The reason for this is because when it comes to emulators, adb, java scripts, and the rest of the stuff, it will cause problems with any directories that have a space in their directory name (Ex: C:\Program Files\). It's better off using the root of your C:\ drive to do that so that way it allows you to rename the folder without unreadable characters such as the space between the name.

    Since you have resolved the problem and are looking to find out what to do next, I would practice pushing APK(s) and removing them. Once you get the hang of how things work, then you can try to learn how to edit APK(s), such as xml editing, 9.png's, png's, smali/baksmali, replacing images with original images, and push those APK(s) onto the emulator for test to see how it looks and understand the proper functions of errors that some APK(s) have when not properly zipaligned, optimized, etc and make adjustments to where it works perfectly. Then you can push the newly edited APK(s) to your phone to enjoy.

    There is endless things to do with the emulator. You can even test out a whole theme on it if you wanted to. I'm not sure about flashing a ROM, such as Liberty 1.5, into an emulator. I haven't tried that one yet but it's worth the try.

    Just make sure you research and learn all your command lines to work with the emulator. The command lines contain 100s of useful lines and the base of the Emulator is all about the command lines.

    I'll pay attention to this thread more. If you have more questions then let me know or shoot me a PM.
    I am having this problem as well. I am following a course online, and followed everything. When I try to run as Android Application though, I get this message, that it exceeds device limit then unable to load section nand_dev.
    Jerry Schrader
    http://jerryschrader.info
    Custom Web Development and Mobile Development

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. MSX Emulator?
    By Moonraker in forum Android Games
    Replies: 3
    Last Post: 10-21-2010, 07:08 AM
  2. Help with Emulator
    By toasttoast in forum Android App Developers
    Replies: 0
    Last Post: 09-17-2010, 02:35 PM
  3. Emulator help
    By Harrizzle in forum Android General Discussions
    Replies: 1
    Last Post: 08-30-2010, 08:19 PM
  4. Help with GB Emulator?
    By tam5070 in forum Android Games
    Replies: 0
    Last Post: 07-21-2010, 07:11 AM
  5. PSX Emulator?
    By NVash in forum Android Games
    Replies: 3
    Last Post: 01-01-2010, 01:05 PM

Search tags for this page

avd emulator

,
emulator: the memory needed by this vm exceeds the driver li
,
emulator] nand: nand dev load disk state ftruncate failed: i
,

how to use avd

,
how to use avd emulator
,
how to use sdk emulator
,

nand: nand dev load disk state ftruncate failed: invalid arg

,
nand: nand dev load disk state ftruncate failied: invalid ar
,

unable to load section nand dev

,
using avd
Click on a term to search our site for related topics.
Find us on Google+