Install
Cordova
Follow these steps to install Cordova:
1. Install Node.js. Cordova runs on the Node.js platform, which
needs to be installed as the first step. Download installer from: http://nodejs.org
2. Go ahead an run the downloaded installation
file. It is recommended to use the default settings. Node.js needs to be added
to the PATH environment variable, which is done by default.
3. To test the installation, open a command
window (make sure you open a new command window to get the updated path
settings made by the Node.js installation), and type:
node --version
If the version number
is displayed, Node.js is installed and working!
4. Install Git. Git is a version control system, which is used
by Cordova behind-the-scenes. Download and install from: http://git-scm.com. Default settings are recommended.
5. Install Cordova. Cordova is installed using the Node Package
Manager (npm). Type the following in the command window to install:
npm install -g cordova
6. Test the Cordova install by typing:
cordova --version
If you see the version
number, you have successfully installed Apache Cordova!
Install
Java
The Android SDK needs the Java Development Kit (JDK) to be
installed (minimum version 1.6). Note that the Java Runtime Environment (JRE)
is not sufficient, you will need the JDK. To check if you have the JDK
installed already, type this on the command line:
javac -version
If you do not have the JDK installed, proceed as follows:
1. Download the Java SE JDK (SE = Standard
Edition) from Oracle:www.oracle.com/technetwork/java/javase/downloads/. Click the Java SE Download to see the list
fo download. Get the "Windows x86" download if you have 32-bit
Windows, and "Windows x64" if you have 64-bit Windows. If you do not
know which version you have, find out using the Control Panel by selecting
"System and Security" and then "System", where you will
find the "System type" saying if your Windows version is 32-bit or
64-bit.
2. Go along and run the downloaded installer
file. Using the default selections should be fine, but take a note of the
directory in which you install the JDK. You will need to add this to the PATH
in a later step below.
3. Next, update your path to include the JDK.
Open the Control Panel, click System and Security, click System, click Change settings, which will open the System Properties window. Select the Advanced tab, then click theEnvironment Variables button.
4. In the list User variables select PATH and click the Edit button. (If there is no PATH entry in the list, click the New
button to create one.)
5. At the end of the field Variable value, add a semicolon followed by the path to the
bin directory of the JDK install. Here is an example (note that this must be
the actual path used for the install on your machine):
;C:\Program Files\Java\jdk1.8.0_11\bin
An easy way to do this
is to prepare the path to add in a text editor, then paste it at the end of the
input field. When done click the OK button.
6. Next add the JAVA_HOME variable if it is not present (and if it is in
the list, you may need to update its value using the Edit button). Click the New button. In the field Variable name type:
JAVA_HOME
In the field Variable value enter the path to the directory where the JDK
is installed, without the semicolon and the /bin subdirectory, for example:
C:\Program Files\Java\jdk1.8.0_11
Click the OK button.
7. Click the OK button again to close
the Environment Variables window.
8. Now you are ready to test the install. Close
any open command windows, and open a new command window and type:
javac -version
If you see a version
number you are done with the JDK install!
Install
Ant:
& download zip file for Ant & extract zip file into
C:\Program
Files\ANT\apache-ant-1.8.4
Then set Environment variables for Ant
type in: ANT_HOME and C:\Program
Files\ANT\apache-ant-1.8.4
All subsequent commands need to be run within
the project's directory, or any subdirectories within its scope:
$ cd hello
Before you can build the project, you need to
specify a set of target platforms. Your ability to run these commands depends
on whether your machine supports each SDK, and whether you have already
installed each SDK. Run any of these from a Mac:
$ cordova platform add ios
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
Run any of these from a Windows machine, where wp refers to different versions of the Windows
Phone operating system:
$ cordova platform add wp8
$ cordova platform add windows
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
$ cordova platform add windows
$ cordova platform add amazon-fireos
$ cordova platform add android
$ cordova platform add blackberry10
$ cordova platform add firefoxos
Run this to check your current set of platforms:
$ cordova platforms ls
CREATING PROJECT FOR ANDORID:
C:\Users\OM>cordova create welcome com.example.welcome HelloWorld
C:\Users\OM>cordova create welcome com.example.welcome HelloWorld
Creating a new cordova project with name
"HelloWorld" and
id
"com.example.welcome" at
location "C:\Users\OM\welcome"
C:\>cordova create
myapp com.example.myapp welcome
Creating a new cordova project with name "welcome"
and id "com.example.myapp" at
location
"C:\myapp"
C:\>cordova
platform add android
Current working directory is not a Cordova-based project.
C:\>cd myapp
C:\myapp>cordova emulate android
C:\myapp>cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path:
platforms\android
Package:
com.example.myapp
Name: welcome
Android
target: android-21
Copying template files...
Project successfully created.
No comments:
Post a Comment