Geertjan's Blog

  • June 27, 2011

5 Step Procedure for Android Deployment with NetBeans IDE

Geertjan Wielenga
Product Manager

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.

Join the discussion

Comments ( 12 )
  • guest Monday, June 27, 2011

    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...

  • Christian Monday, June 27, 2011

    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.

  • guest Tuesday, June 28, 2011

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

  • Toni Monday, August 15, 2011

    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.


  • Toni Monday, August 15, 2011

    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!

  • Jacob Dixon Thursday, October 6, 2011

    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

  • Carlos K. Wednesday, January 25, 2012

    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.

  • raysaun Wednesday, February 1, 2012

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

  • guest Wednesday, February 1, 2012

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

  • Joyel Tuesday, April 17, 2012

    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.

  • guest Tuesday, January 15, 2013
  • guest Saturday, August 2, 2014

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

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.