I prefer Netbeans to Eclipse. I know very little Java, but I’ve kind of grown used to Netbeans while exploring Groovy and Grails. Eclipse is the de facto standard for developing Android apps, although there are a Netbeans plugin. Here is how I got my Netbeans 6.5 instance to work with Android.
First of all, you need to install the Netbeans Android plugin called nbandroid. In Netbeans, go to Tools > Plugins > Settings and click on the Add button and add the plugin update URL: http://kenai.com/projects/nbandroid/pages/Install. Install the Android plugin.
You need to download and extract the Android SDK. The latest version can be found on the Android Development site. Extract the zip file.
The file structure for the new SDK has changed and Netbeans won’t work with the new SDK as is. You have to do the following:
~$ cd path/to/sdk ~/path/to/sdk$ cp -R platform/android-1.5/* ./
Start a new Android project in Netbeans and in the new project window, click the Manage Platforms button.

Select the “Google Android Open Handheld Platform” option and click the Next button.

Navigate to the path where your SDK is (the path to the prepared one as per the above mentioned steps). Click the finish button and it should be good to go.

Before you start hammering away at your newly created Android project, you need to set up an emulator to test your application, else you would not be able to test anything.
You need the API target id in order to create an emulator. Do it as follows:
~/path/to/sdk$ android list targets
Available Android targets:
id: 1
Name: Android 1.1
Type: Platform
API level: 2
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id: 2
Name: Android 1.5
Type: Platform
API level: 3
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id: 3
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Description: Android + Google APIs
Based on Android 1.5 (API level 3)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA (default), HVGA-L, QVGA-P, HVGA-P, QVGA-L
Say you want to test using the Android 1.5 API, you need to specify the target as 2 (see? id: 2) With this information in your arsenal, type the following:
~/path/to/sdk$ android create avd -n avd_1.5_1 -t 2
The -t 2 section of the command is the target id as per the previous command.
The last step is to add the following to your project’s build.xml file.
<target name="-pre-init">
<property name="emulator.options" value="-avd avd_1.5_1"/>
</target>
I.e. your build.xml file should look something like this (without the … truncated … part):
<?xml version="1.0" encoding="UTF-8"?>
<project name="AndroidApplication2" default="default" basedir=".">
... truncated ...
<target name="-pre-init">
<property name="emulator.options" value="-avd avd_1.5_1"/>
</target>
</project>
That’s it! Now make it do something simple and run your application. It should open an Emulator window and run your application. Nifty!

Here are the sources that solved my problems:
http://wiki.netbeans.org/IntroAndroidDevNetBeans
http://kenai.com/…;
Hi there! You should subscribe to my RSS feed here.
You should follow me on Twitter here
You should follow me on Gatorpeeps here.






Posts about google android as of June 9, 2009 | Neto Cury 3:54 am on June 10, 2009 Permalink |
[...] using the GPU/DSP), the stuff that Google is working on to adapt Android 2.0 Donut release Developing Android apps using Netbeans – stii.co.za 06/09/2009 I prefer Netbeans to Eclipse . I know very little Java, but I’ve kind of [...]
Colin 12:11 pm on June 10, 2009 Permalink |
NetBeans rocks. I use it for ALL of my development (PHP, HTML, CSS, Python and a teeny weeny bit of Java) primarily because it’s a great app, but also because it runs perfectly on ALL the platforms I work on (Solaris/OpenSolaris/Linux & OS X)
One word of advice: try the 6.7 beta. It’s a lot quicker to start (as it only loads stuff you need) and it looks a hell of a lot better on OS X too.
Stii 12:22 pm on June 10, 2009 Permalink |
I will check it out! As long as Groovy and Grail work as well as the Android plugin, I’m happy!
karim 3:57 am on June 13, 2009 Permalink |
hello;
when i try to excute the command “android list targets” i have the message “bash: android: command not found” i’m situated in the sdk path !!
i’ve tried also to exort the path of the sdk to my bashrc file but i have the same problem.
please help me.
Stii 10:23 am on June 15, 2009 Permalink |
Could it maybe be that you don’t have execution rights to the android command? Try chmod +x /path/to/android
karim 3:52 pm on June 15, 2009 Permalink |
thx for your help!!
i found the problem : i have to write ./ android list targets
Djessy 6:14 pm on June 29, 2009 Permalink |
Hi, i am trying to install the nbandroid plugin in nb 6.7, for the anddroid sdk 1.5, and Netbeans is not recognizing my android platform, i mean i cannot install it. I d appreciate your help.
Pawan 2:09 pm on October 26, 2009 Permalink |
Try adding SDK tools folder in PATH variable so that netbeans can find out the programs needed for successful android development.