This lesson teaches you to
Build and run
Now that you have all the tools installed, you can build the Todo Lite app. If you have problems building the app, see the troubleshooting section.
Get out a stopwatch, your 5 minutes starts now!
Launch the terminal
Open a terminal window and change to the directory that you want to store the Todo Lite project in.
Create a project
Create a new PhoneGap project and change to it's directory:
$ phonegap create todo-lite com.couchbase.TodoLite TodoLite
$ cd todo-lite
After you create a new PhoneGap project, the project directory contains a directory named www. The www directory contains a default application.
Add the Couchbase Lite plug-in to your project
$ phonegap local plugin add https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin.git
Add the other plug-ins to your project
The following additional plug-ins are used by the example app for various features. The app is partially functional even without them, so you can leave them out if you are troubleshooting.
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
$ phonegap local plugin add https://github.com/apache/cordova-plugin-inappbrowser.git
$ phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
These plug-ins activate the camera, the InAppBrowser, and network information.
Clone the example app source code
Replace the default application in the www directory with the Todo Lite source code:
$ rm -rf www
$ git clone https://github.com/couchbaselabs/TodoLite-PhoneGap.git www
Most of the application code is in the index.js file.
When you develop your own app, replace the default application in the www directory with your source code.
Launch the example app (iOS)
Build and run the Todo Lite iOS app:
$ phonegap run ios
The Todo Lite app opens in the iOS simulator. If the iOS simulator does not open automatically, make sure ios-sim is installed.
Launch the example app (Android)
Build and run the Todo Lite Android app:
$ phonegap run android
The Todo Lite app opens in the Android simulator. If the Android simulator does not open and you are prompted to log on to the Adobe PhoneGap build service, your Android device emulator is not set up correctly. You do not need to sign up for the PhoneGap build service to run this example.