Setup Android Development on Windows 7 64bit

12:12 pm Windows Development

androidwindowsRecently, I started looking into Android development. What I found was that it was very easy to do Android application development and best of all, it is free (unlike Apple’s $99/year development fee). All you need is a computer, your Android phone, and a USB cable to connect the two. (Actually, you don’t even need a phone because you can use an emulated Android phone.)

Here are the steps I took to setup an Android development environment on my Windows 7 64bit desktop:

  1. Download Java JDK 64bit. I downloaded “jdk-6u24-windows-x64.exe” and ran it to install the JDK.
    • Add these User environment variables by running “Edit the system environment variables”, clicking “Environment Variables” button, and setting the following under “User variables…”:
      JAVA_HOME=C:\Program Files\Java\jdk1.6.0_24
      PATH=%PATH%;%JAVA_HOME%\bin
    • Test by opening a command prompt and running “javac -version” to check that Windows can successfully find the javac.exe executable in the PATH.
  2. Download Eclipse 64bit. I downloaded “eclipse-SDK-3.7M6-win32-x86_64.zip” and unzipped it to a convenient directory. You can run Eclipse by launching “eclipse.exe”.
  3. Download the Android SDK. I downloaded “android-sdk_r10-windows.zip” and unzipped it to “C:\Bin\android-sdk-windows”.
    • Important: The Android SDK path must not contain a space!
    • Add these User environment variables using “Edit the system environment variables” like above:
      SDK_ROOT=C:\Bin\android-sdk-windows
      PATH=%PATH%;%JAVA_HOME%\bin;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools

      Note: We just appended the %SDK_ROOT% paths to the existing PATH definition which has the previous %JAVA_HOME% path.

  4. Download the platform files for the Android SDK using the SDK Manager (which is installed as part of the SDK) by following the instructions below.
    • Manually create two folders, “add-ons” and “platforms”, under the %SDK_ROOT% directory. If you don’t, you will see an error like “Error: Error parsing the sdk.” or “Error: C:\Bin\android-sdk-windows\platforms is missing.” in the next step.
    • Run the SDK Manager to download the SDK; look for “SDK Manager.exe” in the %SDK_ROOT% directory. Alternatively you could run from the command line: “android.bat update sdk”.
    • You can use the initial “Choose Packages to Install” dialog to select or reject packages, or you can cancel it and do the following:
      • Select “Available packages” on left.
      • Expand the “Android Repository” on right.
      • Check “Android SDK Platform-tools, revision 3″.
      • Check the Platform, Documentation, or Samples for the Android OS version you want to develop on (which should match the Android OS version on your Android phone). (Eclaire is 2.1, Froyo is 2.2, Gingerbread is 2.3.)
      • For more details on the packages, check the Android SDK Install Guide.
  5. Add the Android Eclipse Plugin (ADT) to Eclipse:
    • Run Eclipse.
    • Select Help->Install New Software…
    • In the “Work with:” field, replace the “type or select a site” with “https://dl-ssl.google.com/android/eclipse/”.
    • Expand “Developer Tools”.
    • Check the “Android Development Tools” box.
    • Click Next, Next, select Accept License…, click Next.
    • Accept the unsigned warning to continue installation.
    • Restart Eclipse.
  6. Configure the ADT:
    • Under Eclipse, go to menu Windows->Preferences.
    • Select Android
    • In the “SDK Location”, browse to your android install directory %SDK_ROOT%.
    • Hit Apply and you should see the Android platform versions you installed earlier populate the table.

Now that you are all setup, let’s use Eclipse to create a project, build it, and then test it.

  1. Create an Android project:
    • Under Eclipse, go to menu File->New->Project…->Android->”Android Project”.
    • Select the Android version in the “Build Target”.
    • Input the “Project name”, “Application name”, and Activity (the primary java class’s filename). (These can all be the same like “HelloWorld”.)
    • Input the Java package hierarchy like “test.android”.
    • Input the “Min SDK Version” like the 8 for Froyo 2.2’s API Level.
    • Click Finish and the project will be created.
  2. Create an emulated Android for our development purpose.
    • Under Eclipse, go to menu Windows->”Android SDK and AVD Manager”.
    • Select “Virtual devices” on the left.
    • Click the New button on the right.
    • Input a name for your virtual device, select a target which should be the same as your project’s build target.
    • Click on “Create AVD” and close this dialog.
    • Click on the Workbench icon on the top-right or close the Welcome tab to see your newly-created project in the Package Explorer.
  3. Under Eclipse, to build and run the project, click on menu Run->Run.
    • The virtual android device should be selected automatically or you will be prompted to select it.
    • To modify this, check menu Run->”Run Configurations…” and select the Target tab for your Android application. Pick Manual so you can have the option to select a real Android phone instead of the virtual one later.
  4. Connecting an Android phone to your computer
    • You will need to find and install the USB drivers for your Android phone. You can usually find them on the phone manufacturer’s website.
    • Note: If you cannot find your Android phone’s USB drivers for your operating system (for example, Windows 7 64bit), try installing PDAnet. It is a free tethering application which comes with USB drivers for a bunch of phones. Make sure to disconnect the phone before installing PDANet.
    • On the phone, go to Settings->Applications->Development and enable “USB debugging” before reconnecting the phone to the computer. This will allow Eclipse to install onto and debug applications on your Android phone.

Hopefully the guide above will help you get started with Android Development. Have fun!

Info above derived from the following sources:

39 Responses
  1. Frank LoPinto :

    Date: January 18, 2012 @ 9:23 pm

    Thank you! Your detailed steps saved me a lot of time and the sample application is running on my phone.

    I’m just getting started with Eclipse and Android. Do you know where I can get pointers on using the camera?

    Frank

  2. Chanh :

    Date: January 18, 2012 @ 9:27 pm

    I’m glad it was helpful, Frank. Do you mean how to use the camera on the Android? If you don’t want to read through the Android SDK, I would suggest using the 3rd party library OpenCV (Open Source Computer Vision) which should be easier. Here’s their link: http://opencv.willowgarage.com/wiki/Android

  3. Inderjeet :

    Date: February 10, 2012 @ 11:31 pm

    Thanks. By following your detailed steps (with few changes for latest Eclipse and Android SDK versions) I saved a lot of time. I was able to run my first of Android App.

    Once again Thanks.

    Inderjeet

  4. Mike :

    Date: March 13, 2012 @ 6:39 pm

    You have earned serious Karma for putting this instruction set together. I have tried several times to set up ADK and ADT Eclipse on Windows 7 32-bit using the Android Developers instructions and several other sites. After installing and un-installing Java, Eclipse, ADT and ADK (probably at least 5 times) to no avail, I finally found your page and it worked the first time up. Thanks again for putting this together, you saved me from a pending break-down.

    Cheers,

    Mike

  5. Nikhil :

    Date: March 21, 2012 @ 9:28 am

    Thank you for taking the time out to help out noob’s like me! Excellent directions.

  6. jahid :

    Date: May 7, 2012 @ 9:48 pm

    Thanks for your steps, it was really helpful…

  7. Riwaj :

    Date: June 14, 2012 @ 9:16 am

    when you say add these environmental veriable

    PATH=%PATH%;%JAVA_HOME%\bin and other path

    PATH=%PATH%;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools

    when I add one, other one gets replaced. I can’t add both PATH unless i change one to different name.

    Is that ok?

  8. Chanh :

    Date: June 14, 2012 @ 10:54 am

    Hi Riwaj,

    Good question. The answer is a little complicated because it depends on context. Before we start, let me introduce some info just to make sure we are all on the same page.

    1) The PATH environment variable defines the list of directories which Windows searches for executable and library files; for example, when you type “Notepad” in the command prompt, Windows will search all the directories in PATH to find “Notepad.exe”.

    2) The embedded %PATH% is resolved to whatever value PATH is currently set to. If you run in the command line, “set PATH=%PATH%;%JAVA_HOME%\bin”, you are adding “%JAVA_HOME%\bin” to the end of the current PATH and setting it as the new PATH. So running the second “set PATH=%PATH%;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools” would just add the “%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools” to the existing PATH which has “%JAVA_HOME%\bin” at the end. Or you could just combine the two into the following:
    set PATH=%PATH%;%JAVA_HOME%\bin;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools

    3) Under the “Edit the system environmental variables/Environment Variables” dialog, Windows allows you to set two types of environment variables, system and user. The user variables will override any system variables of the same name. So if you put “PATH=%PATH%;%JAVA_HOME%\bin” into the User variable, the embedded %PATH% would refer to the System variable PATH content; basically you would be adding “%JAVA_HOME%\bin” to the end of the PATH defined by the System. Alternatively, you could change the System variable directly (and not use a user variable with %PATH%); you would just add “%JAVA_HOME%\bin;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools” to the end of the PATH defined in System variables.

    Having said the above, I realized now that the post content is a bit misleading. I shouldn’t be using the “set PATH” as that is very specific to the command line. Since we are using Eclipse, we should use the Windows “Edit the system environmental variables” dialog. I’ve updated the post to have instructions to set the PATH under user variables to be:
    PATH=%PATH%;%JAVA_HOME%\bin;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools

    Hope that makes it more clear. Regards.

  9. Riwaj :

    Date: June 15, 2012 @ 4:37 pm

    Thank you for taking to reply and for updating the instruction. Yes it makes sense the way you explain everything.
    Before your reply I had already combined both path and set it under system variable ( and not under user variables) as

    Variable = PATH
    Value = %PATH%;%JAVA_HOME%\bin;%SDK_ROOT%\tools;%SDK_ROOT%\platform-tools

    Do I have to move it to user variables or just leave it under system variable?

  10. Chanh :

    Date: June 15, 2012 @ 11:28 pm

    Either User or System is fine; it is a personal preference. However, I’m not sure under System variables, what happens if you have your own PATH defined since the system PATH is already defined there. I think if everything works and you are able to compile and test Android, then wherever you put your PATH definition is fine.

  11. Hemant Kamalakar :

    Date: July 9, 2012 @ 1:05 am

    Thanks for sharing.

  12. Nik :

    Date: July 20, 2012 @ 9:31 pm

    Thanks….Hopes it works…on my lappi…

  13. Nik :

    Date: July 20, 2012 @ 9:33 pm

    Will it be possible with .net platform ?
    Can you help ?

  14. Chanh :

    Date: July 21, 2012 @ 1:13 pm

    Hi Nik,

    I’m not sure what you mean by .net platform. Do you mean you wish to use the .net Visual Studio IDE instead of the Eclipse IDE? If so, I haven’t done much with Visual Studio IDE.

    I did a quick google search on “Android with Visual Studio” and found an article on using C# for Android development at No Java Required: Write Android Apps in C#. Not sure if that will address what you need.

    Good luck.

  15. Joseph Moses :

    Date: August 1, 2012 @ 12:13 pm

    Great Work done. I have tried this over the past 4 days with no avail. It just works fine now. Thanks. I will never forget this day of great tutorials.

  16. Dhananjay :

    Date: August 28, 2012 @ 10:17 am

    Thank you for your share !!!Greatt Work sir.

  17. aslam :

    Date: September 1, 2012 @ 6:44 pm

    I failed at step 4. When I ran “android.bat update sdk” on my cmd, I got
    ERROR:SWT Folder ” does not exist.
    Please Set ANDROID_SWT to point to the folder containing swt.jar for your platform.

    NB: I tried to use the SDK Manager but the command window dissapears immediately.

    How do I fix this? Thanks before

  18. Chanh :

    Date: September 2, 2012 @ 8:18 pm

    It looks like an issue with your path settings, your configuration, or the latest Android SDK. Unfortunately, I’m not doing Android development currently so can’t debug the issue that you are seeing. However, I found a stackoverflow page that has some suggestions concerning this error. Regards.

  19. Joshua G :

    Date: September 19, 2012 @ 6:49 am

    Thank you so much for this guide. I helped a lot during setup.

  20. ymharrech :

    Date: November 1, 2012 @ 4:12 am

    Hi guys

    I followed every step in this tutos but the avd did not launch.
    Please can you help me i am stuck for more than a week!

  21. ymharrech :

    Date: November 1, 2012 @ 4:31 am

    this is what i get
    [2012-11-01 13:29:53 – HelloWorld] ——————————
    [2012-11-01 13:29:53 – HelloWorld] Android Launch!
    [2012-11-01 13:29:53 – HelloWorld] The connection to adb is down, and a severe error has occured.
    [2012-11-01 13:29:53 – HelloWorld] You must restart adb and Eclipse.
    [2012-11-01 13:29:53 – HelloWorld] Please ensure that adb is correctly located at ‘C:\Bin\android-sdk-windows\platform-tools\adb.exe’ and can be executed.

  22. ymharrech :

    Date: November 1, 2012 @ 6:13 am

    Then when i restarted the emuator does not launch
    [2012-11-01 15:02:59 – HelloWorld] Android Launch!
    [2012-11-01 15:02:59 – HelloWorld] adb is running normally.
    [2012-11-01 15:02:59 – HelloWorld] Performing test.android.MainActivity activity launch
    [2012-11-01 15:02:59 – HelloWorld] Automatic Target Mode: Preferred AVD ‘myavd’ is not available. Launching new emulator.
    [2012-11-01 15:02:59 – HelloWorld] Launching a new emulator with Virtual Device ‘myavd’

  23. Chanh :

    Date: November 1, 2012 @ 10:04 am

    Hi ymharrech,

    Sorry to hear that you have having issues. It looks like you are making progress though since your last comment indicates you fixed the adb.exe path issue. Unfortunately, I don’t have a Windows Eclipse+Android setup currently, but I can offer one suggestion.

    Run the SDK and AVD Manager, delete your virtual device, re-create a new virtual device, and launch it directly from there. See if that will work. Once the emulator is successfully launched, you can then go back to run the Hello World program which would then use the running emulator.

    Regards.

  24. ymharrech :

    Date: November 1, 2012 @ 10:06 am

    Still refusing to launch!

  25. Chanh :

    Date: November 1, 2012 @ 10:10 am

    I think we both need more debugging information to isolate the issue. Do you see any errors from the LogCat?

    LogCat is where the adb.exe outputs errors to. You can see its contents by either of the following methods:

    • Under Elipse, you can display the logger debug traces in real-time by going to menu “Window->Show View->Other…->Android->LogCat”.
    • Alternatively, you can open up a Command Prompt window and run “adb logcat”.
  26. ymharrech :

    Date: November 1, 2012 @ 10:14 am

    Hy Chanh

    LogCat shows no comment. I do not know why

  27. ymharrech :

    Date: November 1, 2012 @ 10:17 am

    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    – waiting for device -

  28. Chanh :

    Date: November 1, 2012 @ 10:28 am

    The other idea I have is that you might have a hanging emulator.exe running in the background. Open up the Task Manager, find any running emulator.exe (hopefully that’s the correct name), and then kill it. Then try to start it again. Or better, reboot your machine and then try to start the emulator first thing.

    If the above doesn’t work, I don’t have any more ideas. For more debugging suggestions, you can try looking in this Android development forum post, The Emulator doesn’t start….

    Good luck!

  29. Norbert Beckers :

    Date: November 22, 2012 @ 7:19 am

    I Found an easier way to install an Android development environment. (Certainly if your starting from scratch)
    Just download the ADT-Bundle for windows and inzip it to a folder like c:\Android\. Done. You still need a JDK. if you get some errors you need to set the SDK_ROOT and path like in step 3 in this post.

  30. Chanh :

    Date: November 22, 2012 @ 9:59 am

    Thanks for the update, Norbert. The new ADT Bundle for Windows certainly makes things more convenient because it includes the Eclipse IDE along with the ADT already configured for use.

  31. Dedu :

    Date: January 2, 2013 @ 5:04 am

    Hi guys, I’m facing the same problem as ymharrech. I use ADT bundle for windows. when I launched the AVD, it didnt show up. No logcat message, no device attached in the list of device in DDMS. what should I do?

    thanks

  32. Chanh :

    Date: January 7, 2013 @ 12:46 pm

    Hi Dedu,

    I downloaded the ADT Bundle for Windows 64bit. I used Winzip (or the free 7-zip) to uncompress the bundle instead of the Windows built-in unzip function. I have had issues in the past with the Windows built-in unzip function mangling the Eclipse folders and files (with paths which are very long) so don’t recommend using it.

    I then created a blank Android project and attempted to run it. I got the following error: “Emulator] Failed to allocate memory: 8″. I found a solution at Android emulator failed to allocate memory 8 concerning replacing “1024” with “1024MB” for “hw.ramSize” in the “C:\Users\[user]\.android\avd\[avd-name].avd\config.ini” file. After that, the Android emulator was launched successfully.

    Hope that the solution works for you also.
    Regards – Chanh

  33. Dedu :

    Date: January 7, 2013 @ 11:39 pm

    Hi Chanh,

    Thanks for replying, I really appreciate it. In my case, when I run the android project, I didn’t get the error “Emulator failed to allocate memory: 8″ instead I didn’t get any error messages.

    I used winrar to uncompress the bundle and I also go to the config.ini*file and found that indeed hw.ramSize without “MB” so I added it just as you said.

    After all, the problem still unsolved. My AVD didnt show up, even when I run from cmd, I got “emulator-arm.exe has stopped working”.

    I have done intensive searches for this issue at many forum and found out that none can give an accurate solution for this issue. But I still hope that someone can help me to solve this issue.

    Thanks

  34. hasan :

    Date: January 23, 2013 @ 8:32 am

    i install the required software but i couldn’t open the emulator … every time it’s shows the message

    Starting emulator for AVD ‘AVD_for_Nexus_S_by_Google’
    PANIC: Could not open: AVD_for_Nexus_S_by_Google

    i am trying for now a week ….. please help

  35. hasan :

    Date: January 23, 2013 @ 8:33 am

    i am using windows 7 … 64 bit

  36. Chanh :

    Date: January 24, 2013 @ 2:04 pm

    Hi Hasan,

    I found some hints that the “PANIC: Could not open: AVD_for_Nexus_S_by_Google” error might be caused by path issues. Here is a stackoverflow page, Android Emulator can’t start, ’cause of wrong folder, that has some solutions.

    Regards.

  37. Chanh :

    Date: January 24, 2013 @ 2:06 pm

    Hi Dedu,

    That is unfortunate that you cannot get the Android emulator working. You probably looked at this page already; but just in case, I found an overflow page that references the “emulator-arm.exe has stopped workin” error: Error Message: emulator-arm.exe has stopped working.

    Good luck!

  38. Hiren :

    Date: July 26, 2013 @ 1:19 am

    can u write detailed explanation about windows 8 64 bit setup… i followed same method but avd isn’t opening…

  39. Chanh :

    Date: August 4, 2013 @ 1:37 am

    Hi Hiren,

    I don’t have a Windows 8 machine to test with, but have found references on the web for others who managed to get the Android SDK working on Windows 8. Here is one website, Installing Android Development Tools On Windows 8.

    Good luck, Chanh

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.