Phone - How to do setup to create phonegap application - android

I followed lot of links but not able to run my application.
Steps I followed
Installed node.js.
downloaded eclipse juno.
Installed ADK plugin with https://dl-ssl.google.com/android/eclipse/.
Installed platforms and other thing mentioned in below pictures.
I installed phongap by using npm install -g phonegap command.
I am trying to create a new phonegap app by phonegap create my-app but its giving error
Error: Cannot find module 'cordova-common'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
The way I followed is correct or not? Please give me any link to create new phonegap application from setting required sertup.
Thank you.

try to update Cordova's version to the latest version:
CLI:
sudo npm update -g cordova
It fixed my issue with adding/building ios platform (same error)

Related

How to run an ionic v1 app on Android?

I just received an ionic v1 app that I have to make some changes,but after a fresh installation of ionic, I'm unable to run it. Every time that I run ionic run android in the ionic CLI, I receive this error:
WARN: ionic.project has been renamed to ionic.config.json, please
rename it. Using this version of Cordova with older version of
cordova-android is deprecated. Upgrade to cordova-android#5.0.0 or
newer.
Error: Your android platform does not have Api.js
For the moment I can not migrate to Ionic 2.
What can I do to run/build it?
Fist of all, when you install Ionic this way
npm install -g cordova ionic
You are getting the last CLI that works with Ionic 2, Angular 2 and a different project structure. If you want to run and build an Ionic v1 project you need the tools that works with your version.
To install a specific version you need to add # symbol after the name package and the version that you want for example:
npm install -g ionic#1.7.14
npm install -g cordova#6.0.0
Also you have to keep in mind that Android has been improving their tools too, and this version of cordova doesn't work properly with the latest Android tools chain. This question can help you to download and setup the android tools for this version of cordova.
After that you will be able to run ionic run android

failed to run 'forcedroid create' for a hybrid android app

I am going through salesforce trailhead "Get Started with Hybrid Development".
Now, I try to create a forcedroid hybrid android app with command "forcedroid create".
E:\TempTry>forcedroid create
Enter your application type (native, hybrid_remote, or hybrid_local): hybrid_local
Enter your application name: MyTrailHybridLocal
Enter the target directory of your app: TrailHybridApps
Enter the package name for your app (com.mycompany.my_app): com.mytrail.hybrid
But I failed and got an error message as below.
". Should be in the format x[.y[.ignored]]
) is less than the minimum required version (5.4.0). Please update your version
of Cordova.
In fact, folder TrailHybridApps exists and it is empty. And my Cordova is v6.3.0.
E:\TempTry>cordova -v
6.3.0
So, what's wrong? And what can I do now?
Thanks in advance.
In fact, I have succeeded in finishing a Cordova android app acoording to the guide: https://cordova.apache.org/docs/en/latest/guide/cli/
So, I think my Cordova has no problem and it seems that the question resulted from the "npm forcedroid". On the other hand, I have not github installed. Does it have anything to do with github?
Before running forcedroid create, run this command:
cordova telemetry off
Then forcedroid create should work. Or, you could uninstall Cordova and reinstall with a specific version, i.e.:
npm uninstall -g cordova
npm install -g cordova#5.4.0
You don't have to do anything with github.
You need to update your cordova. This guide shows how to modify Android projects to upgrade from older versions of Cordova. Most of these instructions apply to projects created with an older set of command-line tools that precede the cordova CLI utility. See The Command-Line Interface for information on how to update the version of the CLI.
https://cordova.apache.org/docs/en/latest/guide/platforms/android/upgrade.html
Thanks to you all.
At last I worked out this problem. I would like to share with you all here.
I think it must be a bug of Cordova V6.3.0 or forcedroid create.
Refer to : https://github.com/forcedotcom/SalesforceMobileSDK-Android/issues/1209
As for me, Cordova V6.2.0 works fine while V5.4.0 seemed to result in another error message: Error:'com.android.build.gradle.BasePlugin'.
npm uninstall -g cordova
npm install -g cordova#6.2.0
'cordova telemetry off' doesn't work for me.
Thanks again, special to Richard W, miken32, Ali Nfr and Rajasekar.

Can't build app with Ionic

I am no longer able to build my app and generate an apk anymore because an error shows up. Here is what happens when I try to build the app in the command prompt: Command Prompt
Can somebody please help me with this? Oh and this is what happens if I type ionic info in the command prompt:
Your environment has been set up for using Node.js 0.12.4 (x64) and npm.
C:\Users\Singh>ionic info
Your system information:
Cordova CLI: 5.1.1
Ionic CLI Version: 1.6.1
Ionic App Lib Version: 0.3.3
OS: Windows 7 SP1
Node Version: v0.12.4
C:\Users\Singh>
Try to remove the platform, and then add it again, and then build your application.
So, if you have android as targeted platform execute these commands:
ionic platform remove android
ionic platform add android
ionic build android
My son had a very similar problem, and we never did figure out what caused it. He ended up creating a brand new blank ionic project, and then just copying the www folder from the old project. It worked, and he was able to get things building again. If you try it, you'll also have to re-add your plugins, copy package.json and bower.json, and then rerun bower install and npm install. It's not pleasant, but it might be worth a shot if you're desperate.

Cordova 3.4: How to Manually Install a Plugin

I would like to manually install this plugin into my Android application, which is built on Cordova 3.4. The plugin is compatible with Cordova up to v3.1. The plugin checks to see if geolocation via GPS is enabled on a device.
I've attempted referencing the plugin in res/xml/config.xml, however this reference is removed each time I run cordova build android. The result is that when I run the program I get a Class not found error.
Any thoughts on this particular scenario or just how to manually install a Cordova 3.4 plugin would be greatly appreciated.
Many Thanks!
Add Plugin Features
If you use a platform-specific workflow, you use a lower-level Plugman command-line interface, separately for each targeted platform.
Installing Plugman
To install plugman, you must have node installed on your machine. Then you can run the following command from anywhere in your environment to install plugman globally, so that it is available from any directory: $ npm install -g plugman
Adding a Plugin
Once you have installed Plugman and have created a Cordova project, you can start adding plugins to the platform:
Check this link : Plugman to manage Plugin
Edited : Plugman to Manage Plugins (3.4.0)

phonegap doesn't generate platforms/android subdirectory?

Hi!
I've decided to try out phonegap but i am having trouble getting it set up with eclipse using the CLI as the guides seem to be outdated and inaccurate. Here's what i've done so far to get the phonegap project set up in eclipse:
"phonegap create hello" to create a new phonegap project
then i tried "phonegap platform add android", but gave me a 'is not a node' error
from this question i got the idea that i should instead use "phonegap build android", so i used that command.
According to the android platform guide in the official phonegap website it says that now there should be a platforms/android subdirectory in the phonegap project folder, but there isn't. The platforms folder is completely empty.
Have i missed something? Thank you very much for your help :)
Please try phonegap install android.
By just typing phonegap without any arguments you'll get the basic help and when you want to know more of a specific command do phonegap help <subcommand>
Personally I found the Cordova CLI documentation to be a little more in depth and if you're just building locally you'll have no big difference between the cordova command and the phonegap command as far as I've been able to tell. You only really need the phonegap command if you're using PhoneGap Build as well.
Example:
% phonegap
Usage: /usr/local/share/npm/bin/phonegap [options] [commands]
Description:
PhoneGap command-line tool.
Commands:
create <path> create a phonegap project
build <platform> build a specific platform
install <platform> install a specific platform
run <platform> build and install a specific platform
local [command] development on local system
remote [command] development in cloud with phonegap/build
help [command] output usage information
version output version number
% phonegap help install
Usage: /usr/local/share/npm/bin/phonegap install [options] <platform>
Description:
Installs the application for a specific platform.
Automatically detects platform SDK support and uses the correct environment.
See each environment for available [options].
Examples:
$ /usr/local/share/npm/bin/phonegap install android

Categories

Resources