Plugging Android SDK into NetBeans
Although the Android SDK has been installed, NetBeans doesn’t automatically know about it, so we have to configure NetBeans to recognize Android projects. This is done with a special plug-in. We’ll go over the configuration step by step with plenty of screenshots so you can refer to this hour if needed.
The plug-in has to be downloaded from within NetBeans and is available from a file repository at kenai.com. The plug-in is called NBAndroid, which is short for “NetBeans Android.”
First, open the Tools menu in NetBeans, as shown in Figure 3.6, and choose the Plug-ins menu option.
Figure 3.6. Invoking the Plug-ins dialog using the Tools menu.
If this is a new install of NetBeans, you likely will not have any additional plug-ins installed yet (as expected). The Plug-ins dialog is shown in Figure 3.7. This first tab shows only updates and is normally empty.
Figure 3.7. The Plug-ins dialog has several tabs.
Open the Settings tab, shown in Figure 3.8. Three update centers will be listed (or more, if you are using a more recent version than NetBeans 7.1). The options are not important, but just for reference: Certified Plug-ins, NetBeans Distribution, and Plug-in Portal. We will be adding our own new plug-in source.
Figure 3.8. Viewing the list of plug-in sources.
On the right side is a button labeled Add. Use this button to bring up the Update Center Customizer dialog (see Figure 3.9). This dialog has two fields where you can specify a new source for plug-ins.
Figure 3.9. Adding a new plug-in source (kenai.com).
In the Name field, enter kenai.com. In the URL field, enter this URL: http://kenai.com/down-loads/nbandroid/updatecenter/updates.xml.
Click the OK button to proceed.
NetBeans then parses the URL specified for any available NetBeans plug-ins. Nothing more will come up—just switch over to the Available Plug-ins tab. The Android plug-ins appear at the top of the list (see Figure 3.10). If the list is not sorted alphabetically, click the Name field heading to sort by Name.
Figure 3.10. The list of Available Plug-ins (from all sources).
The only plug-in really needed is Android. Two have been selected in Figure 3.11, but the Android Test Runner plug-in is not essential—usually it’s for testing larger applications. You may skip it if you like.
Figure 3.11. Preparing to install the Android plug-in for NetBeans.
Check the Android plug-in and then click the Install button at the bottom left.
A confirmation window will come up showing all the plug-ins you have selected to install. Click Next.
The new NBAndroid plug-in will be installed. When complete, go to the Installed tab to verify the installation of the new plug-in. See Figure 3.12.
Figure 3.12. The Android plug-in now appears in the Installed list.