5 Step Procedure for Android Deployment with NetBeans IDE

I'm finding that it's so simple to deploy apps to Android that I'm not needing to use the Android emulator at all, haven't been able to figure out how it works anyway (big blinky screen pops up that I don't know what to do with). I just simply deploy the app straight to Android, try it out there, and then uninstall it, if needed.

The whole process (only step 4 and 5 below need to be done for each deployment iteration, after you've done steps 1, 2, and 3 once to set up the deployment environment), takes a few seconds.

Here's what I do:

  1. On Android, go to Settings | Applications. Check "Unknown sources". In "Development", check "USB debugging".

  2. Connect Android to your computer via a USB cable.

  3. Start up NetBeans IDE, with NBAndroid installed, as described yesterday. and create your "Hello World" app.

  4. Right-click the project in the IDE and choose "Export Signed Android Package". Create a new keystore, or choose an existing one, via the wizard that appears. At the end of the wizard (would be nice if NBAndroid would let you set up a keystore once and then reuse it for all your projects, without needing to work through the whole wizard step by step each time), you'll have a new release APK file (Android deployment archive) in the project's 'bin' folder, which you can see in the Files window.

  5. Go to the command line (would be nice if NBAndroid were to support adb, would mean I wouldn't need the command line at all), browse to the location of the APK file above. Type "adb install helloworld-release.apk" or whatever the APK file is called. You should see a "Success" message in the command line.

Now the application is installed. On your Android, go to "Applications", and there you'll see your brand new app. Then try it out there and delete it if you're not happy with it. After you've made a change in your app, simply repeat step 4 and 5, i.e., create a new APK and install it via adb. Step 4 and 5 take a couple of seconds. And, given that it's all so simple, I don't see the value of the Android emulator, at all.


Well, going your way, there may be the problem of f device specific behaviour. Sometimes devices dont work completely like you may expect. Using the Android Emulator you get api speCific environment. So you may avoid device specific behaviour. If I am right you may even choose which android release to use...

So there may be advantages...

Posted by guest on June 26, 2011 at 07:41 PM PDT #

Did you have tried to just "Run" your application? NbAndroid will compile, deploy and run the application on the phone/emulator and you don't need the shell.

"Export Signed APK" will sign your application with the release signature and doesn't support debugging.

Posted by Christian on June 26, 2011 at 08:35 PM PDT #

I find that the emulator is useful for testing things like different screen sizes :)

Posted by guest on June 27, 2011 at 06:57 PM PDT #

Hi Geertjan, seems the plugin has imroved since you wrote this: After step 4 switch to files view, right-click the apk-file and choose "install" from the drop-down menu... No need to go to the commandline.

Posted by Toni on August 15, 2011 at 03:43 AM PDT #

also the keystore is reusable now as far as I see, so it seems your complaint in step #5 has been addressed as well, cool!

Posted by Toni on August 15, 2011 at 03:47 AM PDT #

Thats great news to hear for many developer working with Netbeans IDE and who are also interested and excited to work on android technology too. This is very useful content and I am so glad to hear that news. Great achievement keep it going

Posted by Jacob Dixon on October 06, 2011 at 04:33 PM PDT #

I found out that with NbAndroid it is possible to keep the emulator running to deploy the application. You don't need to close and reopen the emulator. That saves much time.

Now I am striving with some bugs because I can't see any stack trace or logs. The ADB log window does not display any of my log messages or info about the bugs.

Posted by Carlos K. on January 24, 2012 at 07:13 PM PST #

You can use DDMS to display the Log. It is in the Tools folder in the android-sdk.

Posted by raysaun on February 01, 2012 at 03:02 PM PST #

You can use ddms.bat in the tools folder of the android-sdk to display the log.

Posted by guest on February 01, 2012 at 03:04 PM PST #

You don't need to do all of that. Pretty simple. Do steps 1 and 3. Which is standard. Then, just inside NetBeans go to Build and Run, or Run for the project. Whatever android you currently have plugged into your computer via USB will show in the top option portion, and will send it straight to the phone. Even if you update and re-build it just sends the newest copy to your phone. Very easy to use. Allows you to directly use your phone for testing, with only a few easy steps.

Posted by Joyel on April 17, 2012 at 04:42 AM PDT #

Its quite simple to configure Android in Netbeans for developement. Follow the steps here..!!

<a href="http://androidtechstuffs.blogspot.in/2012/12/create-hello-world-android-project-in.html">http://androidtechstuffs.blogspot.in/2012/12/create-hello-world-android-project-in.html</a>

Posted by guest on January 15, 2013 at 10:03 AM PST #

can i develop an offline application in java for android phone..???

Posted by guest on August 02, 2014 at 03:50 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« July 2016