Installing Android SDK on NetBeans

Installing Android SDK on NetBeans

In this article we are going to focus on installing the Android SDK on the NetBeans Integrated Development Environment (IDE). Normally people would use eclipse as their development environment when programming for the OS platform as android.com offers the instructions for doing it this way. We are going to stray from this and use NetBeans as it can also be used for a variety of different languages and has a cleaner interface. To start out we need to make sure that NetBeans is installed and we will need to note what version we are using. After NetBeans is installed we can begin configuring the environment for Android.

The first thing we are going to want to do is install the Android SDK on our computers. Android.com has made this easier for use by offering Windows users an executable file to download and run. After we have downloaded the application we are going to need to locate it. After it has been located we will double click on the executable and the first screen should appear. Below are some screen shots of the options I chose while walking through the install:

After this installation has been completed we can now proceed to start up NetBeans. After NetBeans is open we are going to click on the menu bar and go to Options -> Plugins. This screen is used for adding plugins that can improve the IDE itself or help the way you code. In this instance we are wanting to add the Plugin nAndroid so we can start developing some Android applications in NetBeans. This is the first screen you will be presented with when the plugins option is chosen:

We want to navigate to the settings tab where we will want to go to the Add button and click it. We will be presented with a screen to add the name of the new plugin and the source of the plugin. At the end of this the screen should look something along the lines of this:

We can then proceed to check the box that says Check for Updates Automatically. This is so we don’t have to manually search for an update when there is one. After that is complete we can press OK and see that the plugin has been added to the list but not installed yet. For that to happen we need to click on the tab that says “Available Plugins“. After we are there we can utilize the search box on the right hand side by typing “Android” into it. It should bring up four options of which we will only need two. These two will be “Android” and “Android Test Runner For NetBeans 7” as that is the version of NetBeans we are using. After that the following screen shots will go through the install of the product with you after you press the install button:

After this is done we only have one thing left to do and that is hook in the Android SDK we downloaded into the NetBeans environment. This can be done by clicking on “Tools” in the menu bar and choosing “Options” at the very bottom. We then want to navigate to “Miscellaneous” where we will see an “Android” tab in the mix. Click on it and we will be presented with the following screen:

We need to click browse and then locate the Android SDK. Once found remember the path that the Android SDK is located at as we will need to use this once more before the end of this tutorial. Aftr you have delved into the Android SDK and selected the folder we can then press OK. Afterwards your screen with the location to the SDK should look like this:

We now need to go to our windows explorer, keeping in mind the path the the SDK and find the SDK one more time. After it has been found we will want to double click on the application executable named “SDK Manager”. Once it is open we will want to select all boxes in the “Android Repository” and “Third Party Add-Ons” that will be located under “Available Packages“. Once this is done we can then press “Install Selected” and wait for them to be done.

After the packages have installed you have completed all the requirements necessary to develop an Android application within NetBeans. This tutorial will be helpful if you are interested in Android Development and the new 201 Development series coming to Binary Wasteland in the future. Until the next tutorial, Happy Hacking!

 

Update

It has been determined people were having trouble getting the NetBeans and Android SDK combo to work and it is because one key issue wasn’t mentioned.  When we download the Android SDK we need to add the SDK to a directory that will not have any spaces.  After this is done we need to add that directory to the System Variables under Path. To do this we need to click the start menu, navigate to computer, right click it and pick properties. You then need to click Advanced System Setting on the right hand side of the screen. You will then be presented with the following screen:

 

We then need to then click Environmental Variables and we will then get the following screen:

 

 

We will want to scroll down in System Variables to the Path variable and click the Edit button and we will get this following screen:

 

We will want to navigate to the end of the line and if there is not a “;” at the end then add one.  After that we need to add the path to the Android SDK and more specifically the tools folder as shown above.  We will need to change the reference in NetBeans to the Android SDK.  After this is done you should be able to run the program and the Android SDK will start up and load your program. Any furthur troubles leave a comment below and we will be sure to help! Until next time, Happy Hacking!


Tags assigned to this article:
AndroidAndroidDevCodeDevNetBeansSDK

Related Articles

Get Windows 8 Consumer Preview Wallpapers Now!

Microsoft won’t unveil the Windows 8 Consumer Preview until later today at MWC, but that doesn’t mean some of the

Cool Windows 8 Features – Picture Password

There are many cool Windows features that the average consumer will take for granted. We are here to let the

Beginning Touch Recognition With Android

In this tutorial we are going to learn how to create an application that uses basic touch recognition. In the

  • Rod

    Hmmm… good tutorial, but, as they say, my mileage varied. Did exactly what you did, but then found that there was a bug when I tried loading or creating an android app. Went through the automatic bug reporter (nice feature, Netbeans guys!) and found that there was already on there, bug # 200661, attributed as far as I can see, to Third Party (i.e. the NBAndroid guys…) Could be platform issue, as I’m on Linux not Windoze. Interested to hear if anyone else has a problem…
    Cheers!

  • Zal

     great job
    what  is your advice when i want to learn “how  to make small program on android  as first step ?? i had have already knowledge about java language and it is enough to learn it.
    thank you…

    • Anonymous

      The best place to start would be my Android Development 101 Series I have already made. If you follow this and run into snags leave comments on the Binary Wasteland link I am enclosing:

      http://bnry.ws/android101

      Hope you find this useful and if you have any further questions let me know through the comments :)

      • Zal

         thank you i will see it and i am working on it now,i wish get my first program on android without big problems…

        but i can asked you about any error occur on program?(of course after i searched on google about the error..)
        and thank you again.

        • Anonymous

          Yes you can comment here and I will try and answer any questions you have on Android development.

          Sent from my Windows Phone
          ——————————

          • Zal

             ok
            I’m back with problem

            i want to say all of these point i do it

            insult the android manager
            also add it in to net beans
            what the problem?
            i am trying to run a code but it has error message .

            i think the problem in environment variables on win7
            some people say change the name without space in names in files of sdk i did it but it still have problem.

            this error
            invalid command-line parameter: Files.
            Hint: use ‘@foo’ to launch a virtual device named ‘foo’.
            please use -help for more information

             also some website
            say the path that in win7 must is change
             i doesn’t want to change because my sql program use this path so i know if do ,it will not work again(the my sql program)
            http://www3.0zz0.com/2011/08/19/15/585593409.png
            so if can help me?

          • Anonymous

            I am currently trying to replicate your problem and I will get back to you on this comments section sooner than later hopefully! :)

          • Zal

             ok, take you time..

          • Anonymous

            The post has been updated to include the fix to the problem you have been having :) Hope this helps and let me know!

  • Zal

    i didn’t know what exactly the problem was>>
    now i delete a android sdk and i’m reinstalling it  ..
    but i notice something happened it was working (without change the path on windws)and seeing the mobile phone but i close it .after that didn’t work again.
    now I’m installing it in new folder with name without space .i hope it woks again.
    i want know what is path exactly do..
     do you think if i change the path it will effect to my sql program??
    and thank you for your help..

  • Pingback: Jimmy's Blog » Back To Java & Some Android Test Automation

  • Kg boikanyo

    Hi how do I add the SDK to a directory that will not have any spaces 
    I need your help please!!!

    • Anonymous

      We decided that installing the Android SDK to the C: drive was the easiest way and will allow you to proceed by looking at the update below the post we added! Any other questions let us know!

  • http://www.facebook.com/profile.php?id=100001489253605 Revamp Mycorona

    This is pretty much cool dude.. you rocks.

  • Anonymous

    The only other one I would recomment using is Eclipse if you choose not to go with NetBeans. If you find any others feel free to let everyone know here!

  • Guvnah

    Eclipse is a slow, dirty w&$@#

    • Anonymous

      Hence why we have this great tutorial to use a better IDE with the Android SDK :)

  • Saisarath369

    Thank you boss
    i want to build an application using android tech….
    plz give me suggestions about on what category i can do…..plz say ok
    my mail – saisarath369@gmail.com ……

    • Anonymous

      The category you choose is completely up to you! Just start with an idea and if you need help of references on how to make it tangible on Android that’s what we are here for!

  • Samirpaudyal

    I just found your tutorial today and it is really interesting. But I’m still having problem. I have NetBeans IDE 7.1. Even when I put the semi colon (;) mark on the end of the path line, as you described on the last part of your tutorial, It doesn’t work. When I enter single word package name, It says ”

    Package name must have at least two parts (Android Bug)” and when I enter two words package name, it says ”

    Package name is not valid.” Please help me.

    • Anonymous

      I am looking into this and I will get back to you asap! Thanks for the comment and I hope you enjoy the rest of the tutorials :)

      • Biker

        Hi also getting the same error

      • Biker

        I just figured it out “Two word package name” mean not what i thought it means. Try a package name like com.mypackage ;-) That worked for me

    • HpTerm

      Had same problem but I think what the messages says is to use the dot “.” the package name should be something like “com.test”.

      “Test” is not accepted, “My Test” is not accepted but “com.test” was accepted for me.
      However I don’t know why it is that way

      • Anonymous

        Yes, that is correct. You must have at least two parts to your package. I like to use com.binarywasteland.NAMEofPROJECT as it gives the package a little more definition but to each his own. :)

    • Anonymous

      Samirpaudyal – Please read the comment I have posted to HPTerm as this will fix your errors I believe.  Any further questions please let me know!

  • HpTerm

    Gerg I have a small question.

    In the screen copies you installed under C:Program Files (x86)Androidandroid-sdk and in your “Update” you have installed to C:Androidandroid-sdk

    Just to be sure to understand. The first one was a “mistake” and was not working for you, the correct thing to do is install under a path WITHOUT spaces. Right ?

    BTW thanks for the tutorial

    HpTerm

    • Anonymous

      Yes, you have to install under a directory without any spaces as this will cause issues for you down the road.

  • Pingback: In The Near Future | Code, Sleep, Shred.

  • Pingback: The Near Future: Netbeans + Android SDK | Code, Sleep, Shred.

  • http://www.nissanpacific.com eDDi Hughes

    Awesome write up! Glad to see Android SDK with Netbeans. I referred to this page from my blog. Thanks again!

  • Torbjorn Zetterlund

    I have followed all the steps mention, double checked it, and it looks exactly as you have described.

    I still can not sue it, in NETBEANS when I start a new project, I select Android from the Categories, and I select Android Project from  projects list. I click next and I have to fill in Name and Location. I fill in all parameters and I get an error telling me that ”

    Package name is not valid” I have set the package name to “First Android”.

    What is going on. 

    • http://binarywasteland.com/ Greg R. Jacobs

      the package name needs to be in lower-case letters with no spaces. In our example we use com.binarywasteland.firstandroid – try something like that and let me know the results :)

      • Torbjorn Zetterlund

        that help me through that issue – after the new project was created, I have an error in MainActivity.java file – I got the same problem when I imported a sample project – same problem.

        It telling me that package R does not exist – when i check the hints it tells me Add import for Android.R, is this an issue with finding the Android library or is there a library I have not downloaded correctly.

        • http://binarywasteland.com/ Greg R. Jacobs

          Try building and running the project anyways and I find that the package R gets created then. Let me know how you fair.

  • http://binarywasteland.com/ Greg R. Jacobs

    I personally like the look of netbeans better but the only difference I find is that all of the support if you have problems is based on Eclipse…

  • Vipinkumar 167

    very well 

  • http://binarywasteland.com/ Greg R. Jacobs

    Can you explain this a little more, I am in need of more context please. :)

  • Frank van der Hulst

    All the above is good, and I have it working. What I’m stuck on is using libraries in Android… I have a Java library that I’m using in the PC end of my app, and I want to use the exact same source files as a library in my Android app… i.e. no manual copying of source files or JAR files… changing a source file should automatically change both the PC app and the Android app.

    Can someone give me a nice step-by-step example like above, of how to do this?

    Thanks for any help!

  • Harnesh

    Thanx a lot !! it really Helped

  • krit

    when it tells me it must have two parts, i put a space but it returns back to invalid package name x.x

    • http://binarywasteland.com/ Greg R. Jacobs

      Can you post some code/explain more of what you are talking about or shoot me an email with more explanation to greg(dot)Jacobs(at)binarywasteland ( dot)com?

    • Craig

      I tried using an example posted previously and it failed (something.something.somethingelse), however, when I tried (Something.Something) it worked just fine.
      Also, if “R” is not found from the beginning of the project use:

      import android.R;

      if you input it and you receive yellow underlines then make sure it’s written as follows:

      import android.R;import android.app.Activity;import android.os.Bundle;

  • soha

    hi , thanks for this tutorial , i have problem with target platform , actually in new project window it doesn’t show any target platform to me , but there is two 1.1 and 1.5 platform in SDK folder, please help me!!! thanks

    • http://binarywasteland.com/ Greg R. Jacobs

      Can you explain it a little more and the steps necessary to reproduce this or that were taken leading up to this?

  • Pingback: Install android Web Design Sri Lanka – Web Development Tutorials – SEO Tutorials

  • Pingback: Install Android To Windows 7(32-bit) And Ubuntu 11.10(32-bit) Web Design Sri Lanka – Web Development Tutorials – SEO Tutorials

  • Nikhil Sreekumar

    hey thanks for the tutorial, btw when i am making the android project, its asking for target platform, and i am not finding any for that. could you please help me out?

    • http://gregrjacobs.com GregRJacobs

      Do you have the Android SDK installed and updated with at least one version on it (ie. 4.1.2?)?

    • huktonfonix

      It sounds like you need to create a target for the platform you’re using. Click on tools–>Android SDK and AVD manager. When the SDK manager pops up, click Tools –> manage AVDs. the AVD is the virtual device you’re developing the app for. When the AVD manager pops up, click on “new” and then fill in the form to create your target platform. to get the info for my phone, I went to my phone’s wikipedia page adn it had most of the info I needed. Anyways, when you get a target saved in teh AVD manger, it’ll show up in the form when you’re creating the project. Hope this helps.

  • huktonfonix

    so I followed your tutorial and netbeans/android is up and running. I created a new project and ran it, but when the emulator comes up, I can’t find my program (hello_world) in the menu. so I tried a manual installation next, but I still can’t find the program. when I tried the manual install again, it said that the program was already installed. where did my program get put?

    • http://binarywasteland.com/ Greg R. Jacobs

      Have you checked the App Drawer. That is where all of the developed programs on a currently running emulator would live and show up if installed. Let me know and we can go from there.

      • huktonfonix

        yep, I checked the app drawer and it’s not in there. :( so close…but yet so far. is there some way I can search for it?

        • http://binarywasteland.com/ Greg R. Jacobs

          You could check the settings or when you start your AVD set it to wipe all data when starting so you would have a fresh image every time. Not sure if settings are included in image of Android Emu as it has been a little bit since dev’d on it…starting back up this weekend and I will check :)

  • Dakota Reno

    Did you try running the install as an Administrator? Usually it gives a message if it fails to create or modify the 2 Program Files folder and the system folders due to the wrong permissions.

  • Dakota Reno

    I find Eclipse hard to develop with because of its navigatability at first. But then I got used to it and my system its a little slow even with a dual-core 64bit cpu.

  • esha

    i have jdk6 in my pc but error says that you have to install jdk6……..what to do?

    • MD RONY AHMMOD

      You may install jdk6 successfully but the path of the jdk6 is not found by system correctly. To solve this problem you open the “control panel” double click on the system tool. On the system properties dialog box you select “advanced tab”. On this tab you click on “Environment Variable” button. On the system variable list you select “path” variable and open it for edit. On “Variable value” textbox go to end of the line and type a semicolon then type the full path of the directory where you installed jdk6.

      Example : ;c:\jdk6bin

      After all steps is done this error message is not shown again.

  • Arlene Caballero

    I followed exactly this steps. However, when I tried to ADD the url I got this message:

    Unable to connect to the nAndroid because of Zero sized file reported at http://kenai.com/projects/nbandroid/downloads/download/updatecenter/updates.xml

    Check your proxy settings or try again later. The server may be unavailable at the moment. You may also want to make sure that your firewall is not blocking network traffic.

    Can you help me? What seems to be the problem.? I am using Windows8 and I already disabled my Microsoft Essentials and Windows firewall before doing the steps. Thank you in advance!

    • http://binarywasteland.com/ Greg R. Jacobs

      Arlene – Thanks for the question! I believe this link will asssist you perfectly – http://bnry.ws/6787 – Let us know how it works out and keep us in the loop :)

      • ricricucit

        that link doesn’t work…and i still have the “Check your proxy settings or try again later.” error showing up…any help?

  • Pingback: UPDATES: Installing Android SDK on NetBeans | Binary Wasteland

%d bloggers like this: