Android and NetBeans
July 1, 2010 17 Comments
Hey guys I’m writing this post after few weeks. This time I thought of writing a post about Android. I bought a HTC Hero, the first HTC android phone with the Sense UI . Since the day I bought the phone I wanted to write an app for the phone, but with work didn’t get much time to do that. Finally I found some time to kill, so as a result of that I’m writing this post.
First I wrote my Hello World app using Eclipse. Though it’s a powerful IDE I don’t like the idea of using Eclipse. Therefore I looked for a plugin to NetBeans to develop my first Android app. Among the first few search results I found this article How to setup Netbeans for Android development and it worked the magic. Even though the above mentioned post was written for NetBeans 6.5 it works for NetBeans 6.8 too.
Note: you have to install Android SDK to start. Follow this link to install the SDK Installing the SDK
Ok then lets start developing our first android app; to start work first you have to install NetBeans and have to install the Android plugin by following the above link.
Open NetBeans File -> New Project and you’ll get the screen below select Android as the category and Android Application as the Project and then click next.
And the next part is the Name and Location window its as same as a usual NetBeans project therefore I’m not gonna explain that to you!
OK now lets take a look at the first code this is really simple, the below image is the class which you have to edit.
you have to add these lines of code which is demonstrated on the following image
TextView tv = new TextView(this);
tv.setText(“Hello Android”);
Button bt = new Button(this);
bt.setText(“GO”);
setContentView(bt);
and then you have to hit the run button and it will start the Android emulator
Try more and enjoy
bye for now
😀
Note: This link has more and further details on android development
~~ Rusiru Boteju ~~
After installing the nbandroid plugin on both 6.8 and 6.9 I do not see the same project page you mention above . I am talking about the second image you have, were user selects project location and so on.
I am trying to uninstall the plugin and reinstall it, however I don’t see the plugin listed under the plugin tab .
I do see an Andrpid project category under File -> NewProjects though.
Did you follow this link ” How to setup Netbeans for Android development ” to install the plugin? (hope you followed it). And does it mean you get the project selection window(first image i have given) where the user can select the project he wants if so you should be able to proceed. I have tried this on netbeans 6.8 in ubuntu 10.04 and it worked fine for me did you download android development kit follow this link tell me what happens 🙂
hello frnd, i got such type of error in netbeans , when i run the above application
init:
deps-jar:
Compiling 2 source files to C:\Documents and Settings\user\My Documents\NetBeansProjects\HelloAndroid\build\classes
compile:
Created dir: C:\Documents and Settings\user\My Documents\NetBeansProjects\HelloAndroid\dist
=C:\Documents was unexpected at this time.
C:\Documents and Settings\user\My Documents\NetBeansProjects\HelloAndroid\nbproject\build-impl.xml:411: exec returned: 255
BUILD FAILED (total time: 0 seconds)
plz help me
what to do now?
did you try clean and build i guess the problem was with the dist folder but not sure just check that and tell me 🙂
Raj you get the project in a folder without spaces in the name
Fine app for android thanks for the tip I am already experimenting in my android and perfect
a work in very nice.
Emulator is running on android 3.0 specifiction …
But the MainActivity would not run
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\hcl-cdc\My Documents\NetBeansProjects\compass\build\classes
compile:
=C:\Documents was unexpected at this time.
Result: 255
THIS TOOL IS DEPRECATED. See –help for more information.
Deleting: C:\Documents and Settings\hcl-cdc\My Documents\NetBeansProjects\compass\dist\compass.apk_
jar:
pkg: /data/local/tmp/compass.apk
Failure [INSTALL_FAILED_DEXOPT]
69 KB/s (3325 bytes in 0.046s)
About to start org.me.compass/org.me.compass.MainActivity
Starting: Intent { cmp=org.me.compass/.MainActivity }
Error type 3
Error: Activity class {org.me.compass/org.me.compass.MainActivity} does not exist.
run:
BUILD SUCCESSFUL (total time: 9 seconds)
init:
deps-jar:
Compiling 1 source file to C:\Documents and Settings\hcl-cdc\My Documents\NetBeansProjects\compass\build\classes
compile:
=C:\Documents was unexpected at this time.
Result: 255
THIS TOOL IS DEPRECATED. See –help for more information.
Deleting: C:\Documents and Settings\hcl-cdc\My Documents\NetBeansProjects\compass\dist\compass.apk_
jar:
Can’t dispatch DDM chunk 46454154: no handler defined
Can’t dispatch DDM chunk 4d505251: no handler defined
pkg: /data/local/tmp/compass.apk
Failure [INSTALL_FAILED_DEXOPT]
3 KB/s (3325 bytes in 1.000s)
About to start org.me.compass/org.me.compass.MainActivity
Starting: Intent { comp={org.me.compass/org.me.compass.MainActivity} }
Error type 3
Error: Activity class {org.me.compass/org.me.compass.MainActivity} does not exist.
run:
BUILD SUCCESSFUL (total time: 9 seconds)
Sir,
i m trying to learn android with internet but i have a problem in android with eclipse.i install all the stuff which we need…but when i create AVD then it becomes ok but when i launch that avd then a black window is open and after some seconds its hang…and not responding….what should i do and i also want to know that is netbeans 6.1 supports android
Hi Nakul,
Eclipse is the best IDE to develop android applications. The netbeans approach I have given here is a bit out dated.
What is the program you ran at first by using Eclipse is it just a hello world or some thing else? Usually the instructions provided by the Android development community on Eclipse are accurate I personally use those to do my work and i had no trouble with the AVDs. Can you please explain what happened in detail then i can help you 🙂
I personally recommend Eclipse to develop android applications
Rusiru
while running android project in netbeans it is showing no devices found.pls help me
hey, i have netbeans 6.9 but i don’t noe how to add an android plugin(whenever i start a new project , the android option doesn’t show up) plz hlp!!! i wld be grtful to u!! thnx!!
Pingback: Useful resources for developing Android apps | How To Develop Android Apps NOW
thank youuu,
and please give tutorial about Install Android on Hyper-V.
.
уместный вебсайт https://gk-casino.ru
отрадный ресурс https://casino-top3.fun
you can try here кардинг форум