O'Reilly logo

Supercharged JavaScript Graphics by Raffaele Cecco

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a PhoneGap Project in Eclipse

Now that everything has been downloaded and installed, it’s time to create a PhoneGap project in Eclipse that’s ready for testing on the Android emulator or on a real Android device:

  1. Start Eclipse and select FileNewProject.

  2. Select Android Project from the New Project dialog.

  3. In the New Android Project dialog, enter the details as shown in Figure 10-4. Your default location will be the same as your Eclipse workspace, but you can change this if desired. Choose an Android version that is compatible with one of your virtual Android devices or a real Android device. The package name follows the usual Java rules of package naming—typically, a reverse domain name that is guaranteed unique so it does not conflict with other Java packages.

  1. Go to the root directory of the project and create two new directories: /libs and /assets/www. (Note that the assets directory already exists.)

  2. Copy phonegap.js from the Android directory in the extracted PhoneGap directory to /assets/www.

  3. Copy phonegap.jar from the Android directory in the extracted PhoneGap directory to /libs.

After you’ve created the two directories and copied phonegap.jar and phonegap.js, the project in Eclipse should be structured within the Package Explorer as shown in Figure 10-5.

The New Android Project dialog

Figure 10-4. The New Android Project dialog

Figure 10-5. Project layout in Eclipse

Altering the App.java File

Double-click ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required