Monday, March 16, 2015

Most common PhoneGap/Cordova errors (With solutions)


Are you trying to setup or run PhoneGap/Cordova and errors are making you crazy?
Here is the list of most common errors faced while working with PhoneGap/Cordova with possible working solutions.



1- Cordova Install Error- Please Install Android Target 19
Command : $ cordova platform add android
Error: Please install Android target 19 (the Android newest SDK). Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.
Solution : run the command android
Select Android 4.4.2 (API19) and install.

2- Error: ENOENT, stat 'C:\Users\{App Name}\AppData\Roaming\npm
Command : npm install - cordova
Solution : Try to RUN the command after opening CDM with administrator rights, if still error comes then
Browse to the Roaming folder and create a "npm" folder.

3- Error : No emulator images (avds) found
Command : cordova emulate android
Solution : android create avd -n <name> -t <targetID>
where
<name> :  You can use any name you want for the AVD, but since you are likely to be creating multiple AVDs, you should choose a name that lets you recognize the general characteristics offered by the AVD.
<targetID> :  An integer assigned by the android tool. Use android list targets command to list the target ID of each system image.

4- Error: This platform has more than one ABI. Please specify one using --abi.
Command : android create avd -n <name> -t <targetID>
Solution : android create avd -n <name> -t <targetID> -b<abi>
where
<name> :  You can use any name you want for the AVD, but since you are likely to be creating multiple AVDs, you should choose a name that lets you recognize the general characteristics offered by the AVD.
<targetID> :  An integer assigned by the android tool. Use android list targets command to list the target ID of each system image.
<abi> : It is application binary interface and we can get it using android list targets command inside every target as Tag/ABIs

id: 3 or "android-21"
     Name: Android 5.0
     Type: Platform
     API level: 21
     Revision: 1
     Skins: HVGA, QVGA, WQVGA400, WQVGA432, WSVGA, WVGA800 (default), WVGA854, WXGA720, WXGA800, WXGA800-7in
     Tag/ABIs : android-tv/armeabi-v7a, android-tv/x86, default/armeabi-v7a, default/x86, default/x86_64

Note : Use default/armeabi-v7a for android mobile emulator

5- Error: 'npm' is not recognized as internal or external command, operable program or batch file
Solution : Find path to the nodejs folder in the C drive usually it is "C:\Program Files\nodejs\" and add it to system variable "PATH". Now restart the command prompt.
OR you can also use node node.js command prompt which can be found under the node.js folder in start menu.

6- 'phonegap'/'cordova' is not recognized as an internal or external command
Solution : Install phonegap or cordova using command line interface or folloe this article to install phonegap or cordova.


Keep visiting for more...

Last Updated on : 12/06/2015
Related Posts Plugin for WordPress, Blogger...

Receive all updates via Facebook. Just Click the Like Button Below

You can also receive Free Email Updates: