As you may already know PhoneGap 2.0 was released last Friday. This is a major release that brings some new features and lots of changes around the way you create and setup your development environment. For example to create a new iOS/PhoneGap project you don’t use a wizard from Xcode anymore; now you need to launch a bash script from command line. Below you will find two short video tutorials that demonstrate how to get started for both Android and iOS platforms. Also after the videos you can find some additional steps that I had to go through in order to get everything running properly. I know these steps may not be necessary for all. I’ve tested it also on my colleague’s less polluted Mac and everything worked out of the box
iOS additional steps
1) Remember to get Xcode Command Line Tools installed, using the Install button next to the Preferences > Downloads > Components > Command Line Tools option.
2) If you happen to get the following error:
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
You can fix it by the invoking following command, with the path after the -switch parameter pointing to where you have Xcode installed:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
3) If you want to run iOS Simulator from the command line you will need to install the ios-sim app that is available on GitHub. Not having
ios-sim may also result with a following error in a console when running a
Error: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or “brew install ios-sim” using homebrew: http://mxcl.github.com/homebrew/
The easiest way to install ios-sim is to use homebrew. To install homebrew you either follow the instruction on its website, or just invoke the following script:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
After homebrew is installed you may want to run its doctor function to verify that everything was setup correctly:
If brew doctor says everything is alright just run this:
brew install ios-sim
4) UPDATE 27.07.2012: You may wonder why the size of iOS projects has grown significantly to something like ~15MB. This is because starting from PhoneGap 2.0 a default project contains assets like splash screens and icons for new iPad Retina displays. So if you are not targeting these new devices make sure you remove these assets and you should be back to something like 1+ MB
Android additional steps
1) With Android the most important thing to do before running any of the new command line scripts is to download and install Android SDK, and to add the
platform-tools folders to the PATH environment variable. This can be done with following statement (of course correct it to match your folder structure):
2) If you happen to have Android 2.2 SDK installed and configured as your default target you may want to delete the xlargeScreens attribute from AndroidManifest.xml. This happened to me and I got following error:
Add SDK version that has support of xlargeScreens, (I believe that should be any starting from 3.x)
/Users/pwalczys/Projects/PG2/android/bin/AndroidManifest.xml:22: error: No resource identifier found for attribute 'xlargeScreens' in package 'android'