How to get started with Android and Netbeans
How to get started with Android and Netbeans
and Netbeans
Filed under: Android,HowTo,netbeans — devdude @ 7:57 pm
Tags: Android, netbeans, plugin
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 !
New Android
Project
6. 7. package
org.me.hellodroi
d;
8.
9. 10.
11.
12. 13. import
android.app.Activi
ty;
14.
15. 16. import
android.os.Bund
le;
17.
18. 19. import
android.widget.TextVi
ew;
20.
21. 22.
23.
24. 25. public class MainActivity
extends Activity {
26.
27. 28.
29.
30. 31. /** Called when the activity is first
created. */
32.
33. 34. @
O
v
e
r
r
i
d
e
35.
36. 37. public void
onCreate(Bundle icicle) {
38.
39. 40. super.onCreat
e(icicle);
41.
42. 43.
44.
45. 46. setContentView(R.lay
out.main);
47.
48. 49. TextView tv = new
TextView(this);
50.
51. 52. tv.setText("Hello,
Android");
53.
54. 55. setContent
View(tv);
56.
57. 58.
}
59.
60. 61.
}
62. Here my problems started..
63. Compile the projectProblem 1: Cannot compileUnable to
access jarfile ..\framework\apkbuilder.jara) Check there
are no spaces in your path to the jarfiles in the SDKb)
Change the apkbuilder.bat file in the tools folder of the
SDK
64. 65. set
jarfile=apkbuild
er.jar
66.
67. 68. set
framewor
kdir=
69.
70. 71. se
t
li
bd
ir
=
72. to
73. 74. set
jarfile=apkbuild
er.jar
75.
76. 77. set frameworkdir={your_path}\android-sdk-windows-
1.1_r1\tools\lib\
78.
79. 80. set libdir={your_path}\android-sdk-windows-
1.1_r1\tools\lib\
81.
82. 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.
83. 84. Deleting: V:\VAR_Projects\HelloDroid\dist\
HelloDroid.apk_
85.
86. 87.
ja
88.
89. 90. Re
su
lt
:
-
1
91. Either you leave the emulator running after the first failed
attempt or start the emulator manually from the tools
folder.
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.
The simplest way how to install nbandroid modules and keep them
updated is to register an autoupdate center in your NetBeans
installation. Address of this update center is
http://kenai.com/projects/nbandroid/downloads/download/updatecenter/
updates.xml. To register this update center, simply go to Tools ->
Plugins. Then follow this sequence of screenshots to register nbandroid
update center and install plugin:
92. In Settings tab press Add button and fill name and URL:
• In Available Plugins tab enter android in Search text field, check
found plugin.
• Check also appropriate version of Android Test Runner plugin. (See
below for more details on this topic).
• Press Install
• Press Next
• Accept the license
• Press Continue (and ignore warning about unsigned plugin for now)
• You're done, you can start Android development...
Install from downloadable ZIP archive
If you want to get fresh bits rather than less frequently but perhaps more
stable bits from our download area you can register an autoupdate
center generated by nbandroid continuous build. This one is updated
after each code integration that passes tests suite. Address of this
update center is
http://deadlock.netbeans.org/hudson/job/nbandroid/lastStableBuild/
artifact/build/updates/updates.xml. Steps to register this update center
are very much the same as when registering the update center
described above except the different URL. Again go to Tools -> Plugins.
Then follow this sequence of screenshots to register nbandroid update
center and install plugin:
• In Settings tab press Add button and fill name and URL:
4) Select Google Android Open Handheld Platform, click next and it will
ask you to choose the sdk folder.
5)Next you will have to select the target platform from the list
6) Please select the platform of your choice and click finish to complete
the wizard.
Now you are all set to create an android application in netbeans. You
can just create a new android project and start coding on it. Just a word
of caution in my case the emulator took some time to start. It could be
due to the fact that i m using an Intel atom based laptop.
Do enjoy coding for android and let me know your feedback