How to get started with Android and Netbeans

Update 2011-04-08: The plugin has improved. Now it is  just a matter of installing the plugin, creating an Android platform and create a new app. (Link)
Below information is outdated !

The Android development environment currently comes as a SDK 1.1 and can be used as a Eclipse plugin (ADT). The installation is easy and well documented, but I still summarize the steps to get it running in Netbeans and highlights some of the glitches I experienced until it was running.

  1. Download the SDK from (link)
  2. Unpack the zip file to your harddisk (DONT use paths with spaces !).
  3. Read the installation guidelines (link). Skip the Eclipse part, but look at the path settings.
  4. Follow the instructions for the Netbeans plugin installation at the Kenai project (link)
  5. Follow the quickstart guide to configure and setup Netbeans and start your first “HelloWorld” project.
    New Android Project

    New Android Project

    import android.os.Bundle;
    import android.widget.TextView;
    public class MainActivity extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle icicle) {
    TextView tv = new TextView(this);
    tv.setText("Hello, Android");

    Here my problems started..

  6. Compile the project
    Problem 1:  Cannot compile
    Unable to access jarfile ..\framework\apkbuilder.jar
    a) Check there are no spaces in your path to the jarfiles in the SDK
    b) Change the apkbuilder.bat file in the tools folder of the SDK 

    set jarfile=apkbuilder.jar
    set frameworkdir=
    set libdir=


    set jarfile=apkbuilder.jar
    set frameworkdir={your_path}\android-sdk-windows-1.1_r1\tools\lib\
    set libdir={your_path}\android-sdk-windows-1.1_r1\tools\lib\
  7. Run the project (in the emulator)
    Problem 2:  The emulator starts up but the application (filename.apk) is not executed (not uploaded in the first place), even the emulator is started by Netbeans. 

    Deleting: V:\VAR_Projects\HelloDroid\dist\HelloDroid.apk_
    Result: -1

    Either you leave the emulator running after the first failed attempt or start the emulator manually from the tools folder.

    Android Emulator

    Android Emulator

Thats about all I can add at the moment. Now walk through the manuals and tutorials to get some real applications running and waiting for the device to arrive here for the real thing.

8 thoughts on “How to get started with Android and Netbeans

  1. please help me!
    Can I have a project hello world with netbean android project?
    please send to me>>
    thanks very much1

  2. Hi, mine works fine from the start so never had this problem bu…

    I am new at this and from what I have read on the net generally…
    an AVD such as the one shown above must be higher in ‘level’ than the code or software that runs on it.

    also, the directory paths must not contain spaces.

    I downloaded and installed this plugin here.

    when choosing a platform…from tools java platform – java platform manager
    I chose the android + google apis rather than the standard android platform

    perhaps this may work.

    and the avd I chose was android 2.0.1 avi level 6 which was the highest as at 10/12/09 hope this helps…but just info on what my setup is rather than a diagnosis

  3. Pingback: nblog » Android programing in NetBeans

  4. i have created android program in netbeans but when i run this program it is giving message like this

    C:\Documents and Settings\paruthi\My Documents\NetBeansProjects\AndroidApplication2\nbproject\build-impl.xml:411: exec returned: 255
    BUILD FAILED (total time: 1 second)

    plz give me solution

Leave a Reply to quanghoa Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s