Cordova/Phonegap command doesnt execute - android

I have a problem during my cordova/phonegap installation. I did every step in this PhoneGap Tutorial
But when I try to execute "$cordova create" I get the message "cordova: command not found". When I try to execute "$phonegap" nothing happens.
Any idea, what to do?
How can I reinstall everything? How can I check my installation?

What version of Cordova do you have installed? The latest stable at this time is 5.4.1
You can check cordova version using the command
cordova --version
If by any chance you ended up with this error after an update, you can try uninstalling Cordova globally using -g(global) flag and install again using sudo npm update -g cordova
For steps regarding installation and update, please refer to the original documentation here
You might need to create a fresh cordova project after installation/update and move your config preferences and www to the freshly created project/folder.

Related

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 add Android platform and build ionic project anymore?

So I wanted to start a new ionic project by writing:
ionic start Ionic1 blank
After that I moved to that new directory and wanted to add android platform:
ionic platform add android
I then got this error:
Error: Failed to fetch platform android
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: EACCES: permission denied, open '/home/think/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore'
I don't know why this happens. I tried these:
1) change the permision with
chmod 744 /home/think/.cordova/lib/npm_cache/cordova-android/4.1.1/package/.npmignore
2) uninstalled and installed nodejs, cordova, ionic, etc.
3) Executed with sudo ionic platform add android (but "sudo" is not necessary i think since I added android platform before in other projects without having to write "sudo" )
Still it's somehow not possible to add a platform.
I'm on ubuntu 14.04 LTS. I have android SDK manager installed.
I can build and run my other ionic projects that I created earlier. But since yesterday I can't build new projects anymore. It happened when I iupdated to ionic 1.7.13. I tried to downgrade ionic to an earlier version but that wouldn't solve the issue either.
Maybe this is a cache problem of cordova. Delete the cache and try to add the platform again:
rm -rf ~/.cordova
I have no idea what went wrong. i just installed cordova and ionic again and now it's working. For those who encountered the same problem: The commands I executed:
sudo npm install -g cordova
sudo npm install -g ionic
After that add, build, and run the project just as usual.
Try adding it with cordova instead of ionic.
cordova platform add android

Ionic build android in CLI does nothing

I really tried to avoid having to ask this question but I've been stuck on this for a good two days. The problem is that when I try to run the command "ionic build android" I get nothing. No error response, no warning, nothing.
I installed node.js and made my npm global so I can access it anywhere. I installed ionic and cordova via npm install and I was able to start the application and see it on the web but when I try to run it on my device, I don't get any response at all.
What am I missing? I have all the android sdks as I normally write my android applications natively. I installed Ant view homebrew. I'm quite lost.
Apparently there was a bug in Node 5.0.0 causing this.
I had the same issue as you, remedy, and was able to resolve it today by updating to the latest version of node (5.2.0 as of today):
sudo npm update -g
For some reason not (yet) known to me, the cordova command was no longer available after this update (returning "/usr/local/bin/cordova: No such file or directory"), but reinstalling cordova by calling
sudo npm install -g cordova
helped. After these two updates the ionic build ... and cordova build ... commands worked again.
So downgrading node to version 4 is apparently no longer necessary to resolve this.

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.

Issue with installing phonegap 3.3.0?

I am trying to install the phonegap version 3.3.0, So I have installed nodejs and I run the following command,
npm install -g phonegap
By running the above command I am getting the following error.
Can any one suggest me the solution for the above issue?
My Project creation.
You need to install git and make sure that git paths are available on system variable path. Most likely path will be set all by itself with install.
Git Link

Categories

Resources