introduction of phonegap installation and configuration of phonegap with android

43
Installation of Phonegap Rakesh Jha M. Tech, MBA

Upload: rakesh-jha

Post on 02-Jul-2015

218 views

Category:

Mobile


7 download

DESCRIPTION

Introduction of phonegap installation and configuration of Phonegap with Android

TRANSCRIPT

Page 1: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of Phonegap

Rakesh Jha

M. Tech, MBA

Page 2: Introduction of phonegap   installation and configuration of Phonegap with Android

Install

• To Install, ensure that you have NodeJSinstalled, then open your commandline and run the following:

C:\> npm install -g phonegap

• Once installation completes, you can invoke phonegap on command line for further help

Page 3: Introduction of phonegap   installation and configuration of Phonegap with Android

Usage

$ phonegap create my-app

$ cd my-app

$ phonegap run android

Page 4: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 5: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 6: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 7: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 8: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 9: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 10: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 11: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 12: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 13: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 14: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

npm install -g phonegap

Page 15: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• Open command line

• Enter below command :

npm install -g phonegap

Page 16: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 17: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 18: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• You will get above error if you not configure system (environment variable)

• You will get error if not restarted your system after nodejs installation.

Page 19: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• The Problem is you need to set environment variable.

• Start -> Control Panel -> System and Security -> System -> Environment variables

• or

• Mycomputer -> Right Click -> properties -> Advance System settings -> Environment variables under User variables for youruser:

Page 20: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT% \System32\WindowsPowerShell\v1.0\;C:\Users\user1\AppData\Roaming\npm\`

• Temp: %USERPROFILE%\AppData\Local\Temp

Page 21: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• Click the Start menu and type "regedit" on the search box. This will launch the Windows Registry Editor program.

• Enter to the following Registry entry: HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings

• Select the "Enabled" entry in the right side window. If this entry is there, right-click and select "New" followed by "DWORD Value." Name the value "Enabled."

• Right-click the "Enabled" entry and click "Modify."• Change the number in the "Value" box to "1." This will re-

enable WSH.• close all opened cmd windows and open a new window.

Page 22: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 23: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

Page 24: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• Create project with commands –

phonegap create my-app

Note – My-app is project name

Page 25: Introduction of phonegap   installation and configuration of Phonegap with Android

Installation of NodeJS

• You will get below error

Page 26: Introduction of phonegap   installation and configuration of Phonegap with Android

Installing the Android Development Environment

• You’ll learn how to install the tools needed to build Android applications.

• If necessary, you’ll create an Android virtual device (AVD)

Page 27: Introduction of phonegap   installation and configuration of Phonegap with Android

Installing the Android Development Environment

• You’ll learn how to install the tools needed to build Android applications.

• If necessary, you’ll create an Android virtual device (AVD)

Page 28: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

• Before you can build Android applications, you must install the Android SDK.

• Installing the Android SDK also installs the AVD Manager, a graphical user interface for creating and managing Android Virtual Devices (AVDs).

Page 29: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

• From the Android web site, download the correct version of the Android SDK for your operating system.

• Unzip the archive to a location of your choosing. For example, on Linux or Mac, you can place it in the root of your user directory. See the Android Developers web site for additional installation details.

Page 30: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

• Configure the ANDROID_HOME environment variable based on the location of the Android SDK. Additionally, consider adding %ANDROID_HOME%/tools, and %ANDROID_HOME%/platform-tools to your PATH.

Page 31: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

• The Android SDK download does not include specific Android platforms.

• To run the code in this guide, you need to download and install the latest SDK platform.

• You do this by using the Android SDK and AVD Manager that you installed in the previous section.

Page 32: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

1. Open the Android SDK Manager window:

2. Select the Tools checkbox.

3. Select the checkbox for the latest Android SDK, Android 4.4.2 (API Level 19) as of this writing.

4. From the Extras folder, select the checkbox for the Android Support Library.

5. Click the Install packages… button to complete the download and installation.

Page 33: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

1. You may want to install all the available updates, but be aware it will take longer, as each API level is a large download.

Page 34: Introduction of phonegap   installation and configuration of Phonegap with Android

If necessary, create an Android virtual device

1. If you do not have an Android device for testing, you can use an Android virtual device.

2. To do this, you must first install the Android SDK and install the corresponding SDK platforms and packages.

Page 35: Introduction of phonegap   installation and configuration of Phonegap with Android

If necessary, create an Android virtual device

1. This command creates a new AVD named "Default" that is based on Android 4.4.2, API Level 19:

android create avd --name Default --target android-19 --abi armeabi-v7a

Page 36: Introduction of phonegap   installation and configuration of Phonegap with Android

If necessary, create an Android virtual device

1. As an alternative you may also use the android GUI tool to create an AVD.

2. Here is more information about some of the parameters used:

• --name Name of the new AVD.

• --target Target ID of the new AVD.

• --abi The CPU/ABI to use for the AVD.

Page 37: Introduction of phonegap   installation and configuration of Phonegap with Android

If necessary, create an Android virtual device

1. This command displays a list of available targets.

2. Use these targets to create different AVDs based on different Android versions as appropriate

android list target

Page 38: Introduction of phonegap   installation and configuration of Phonegap with Android

If necessary, create an Android virtual device

Finally key points

1. JDK must install

2. Nodejs must install

3. Ant must install

Then run below commands –phonegap run android

Below screen will launch

Page 39: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

Page 40: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

Page 41: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

Page 42: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment

Page 43: Introduction of phonegap   installation and configuration of Phonegap with Android

Set up the Android development environment