Developing a PhoneGap Android app using NetBeans
Looking all over the Internet, I actually had a hard time finding instructions on how to make PhoneGap work in NetBeans, so here I am providing the steps I used to make PhoneGap apps using NetBeans.
Creating a PhoneGap project
Before looking into how to make it work in NetBeans, we first need to install PhoneGap and all its dependencies.
Basically, you need to install the latest JDK, Apache Ant and the latest Android Development Kit (the ADT bundle is not necessary). And make the following command lines work properly: java, javac, ant, adb and android.
Once every command lines above are working, you can attempt to create your first PhoneGap app project. To do so, you need to download the latest PhoneGap release and install it somewhere on your computer (spaces in the path to PhoneGap are to be avoided). Now, using your favorite command line utility, navigate to the path where PhoneGap was installed, and go into “lib/android/bin”, you are now ready to create your first project, the command line to use is the following: create <project_folder_path> <package_name> <project_name>. project_folder_path is the path to your new project (must not already exist). package_name is the name of your app package usually something of the likes of com.company.appName (hyphens and spaces are not allowed). project_name is the name of your app (hyphens and spaces are not allowed).
Congratulations! You just created your first PhoneGap project. Oh wait, we can’t actually use it, we need to set up NetBeans.
Setting Up NetBeans for our PhoneGap Android App
One plugin is actually all that’s needed to be able to develop your PhoneGap app: the Android plugin. The problem is that it is not an official NetBeans, you can’t find it on NetBeans Site. You can install it using the following instructions on the plugin’s site: http://www.nbandroid.org/p/installation.html.
Once the plugin is installed, you just need to open your project in NetBeans. You don’t need to create it, the project was already created using the PhoneGap command line and is automatically recognized by NetBeans. You can now run the project by right-clicking it in your project panel and selecting Run. A prompt will ask you which device (AVD) you wish to use to run your project, select one.
You are now ready to get started developing PhoneGap Android apps with NetBeans.