introduction of phonegap installation and configuration of phonegap with android
DESCRIPTION
Introduction of phonegap installation and configuration of Phonegap with AndroidTRANSCRIPT
Installation of Phonegap
Rakesh Jha
M. Tech, MBA
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
Usage
$ phonegap create my-app
$ cd my-app
$ phonegap run android
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
npm install -g phonegap
Installation of NodeJS
• Open command line
• Enter below command :
npm install -g phonegap
Installation of NodeJS
Installation of NodeJS
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.
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:
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
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.
Installation of NodeJS
Installation of NodeJS
Installation of NodeJS
• Create project with commands –
phonegap create my-app
Note – My-app is project name
Installation of NodeJS
• You will get below error
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)
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)
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).
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.
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.
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.
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.
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.
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.
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
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.
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
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
Set up the Android development environment
Set up the Android development environment
Set up the Android development environment
Set up the Android development environment
Set up the Android development environment