I just added the platforms and plugin files to the .gitignore and ran these commands
git rm -r --cached .
git add .
git commit -m "message"
After successful pull and push, I was not able to run in the android device using the command
ionic cordova run android --device
Yes, I got the answer. I just Removed the android platform using the command
ionic cordova platform rm android
and then I added the android platform again using
ionic cordova platform add android
Related
I am using Ionic 3. Right now I'm trying to do ionic cordova build android , but I get TypeError: env.runcmd is not a function (please see the photo attached).
I tried to:
-> ionic cordova platform rm android then ionic cordova platform add android then again build android again
-> delete node_modules folder and do npm install then build android again
But none of them helped it...
My ionic info output:
Just use command 'cordova run android' instead of 'ionic cordova run android'.
Okay, guys, the problem was exactly with cordova version. I haven't noticed when it did update to the version 7.0.1. However, I had to downgrade it to version 6.5.0 and then android build succeeded.
The only thing that confused me was the downgrade process. Every time I did sudo npm uninstall cordova -g, the cordova command was still available at bash. If I would do sudo npm install cordova#6.5.0 -g, the version still remained 7.0.1. Even some other commands such as ... --save --save-exact ... did NOT work.
So below are the steps which I've gone through to solve this issue (I am using Ubuntu linux, so this will work for linux users only).
First I uninstalled cordova through npm
sudo npm uninstall cordova -g
Then removed the program from local bin
sudo rm /usr/local/bin/cordova
Installed the specific version of cordova
sudo npm install cordova#6.5.0 -g (or whatever version you want)
And lastly, I have to admit that after cordova installation, it was now located at /usr/bin/cordova, no more at /usr/local/bin/cordova, so I had to create a hard link to it.
sudo ln -s /usr/local/bin/cordova /usr/bin/cordova
VoilĂ !
I have successfully executed the following commands
$ npm install -g cordova
$ npm install -g ionic
$ ionic start myApp blank
$ cd myApp
$ ionic platform add android
But the next command is not working
$ ionic build android
when I execute the command, I see an error ie "No platforms added to this project. Please use 'cordova platform add platform'"
please help me with your suggestions, thank you
please do following:
npm install -g cordova
npm install -g ionic
ionic start myApp blank
cd myApp
cordova platform add android
you can use cordova while installing platform in ionic project because Ionic internally use cordova itself.
Please feedback me if error still persist.
Thank you
cordova platform rm ios
cordova platform rm android
cordova platform add ios
cordova platform add android
// edit
to execute these commands, you have to be in your root folder (where you have your config.xml)
use this command before you build cordova platform add android.
enjoy your code time.
I have a weird problem in my Ubuntu 14.04.
I was developing a mobile application using Ionic with an API using Django-Rest-Framework. After developing, I downloaded jdk and Android SDK so that I can build the mobile app into APK. I also downloaded the android dependencies or tools needed for building. After I downloaded it all, I go to my mobile app folder and type ionic platform add android to build it. But the terminal response with "No command 'ionic' found". Even typing ionic serve responses the same. I also tried to activate the virtual environment of the API using workon mobile but it responses with workon: command not found. Does anybody have an idea what might be wrong? Thanks
First Check ionic is install or not by using following command
ionic -v
It shows version if it nothing to show then install ionic by using following command
sudo npm install -g ionic
else update ionic by the following command on your terminal
sudo npm update -g
And also if you have not got the result then create symbolic link by using following command
sudo ln -s /usr/bin/nodejs /usr/bin/node
Hope this will help you !!
First install using this two line..
npm install -g cordova ionic
ioniv -v && cordova -v
and then use this line
$ ionic start myapp [template]
$ cd MyIonic2Project/
$ ionic serve
I am trying to run the phoneRTC demo, I hae build the android demo app and have a signalling server running but when I run the client app on android all I get is a blank screen.
these are the steps I have taken:
npm install -g cordova bower grunt-cli
git clone https://github.com/alongubkin/phonertc.git
ionic create phonertc-ionic
cp -R phonertc\demo\client\* phonertc-ionic\
cd phonertc-ionic
npm install
bower install
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
cordova plugin add https://github.com/alongubkin/phonertc.git
cordova platform add android
cd ../phonertc/demo/server
npm install
node index.js
change server details in phonertc-ionic/app/scripts/signaling.js to:
var socket = io.connect('http://my_server_ip:3000/');
and run the following in phonertc-ionic:
grunt build --force
cp -R app/* www/
cordova build android
My signalling server is running but when I try to hit the port via a browser I get the following message:
Error: ENOENT, stat '/home/server/index.html'
and when I run the app on my phone I just get a blank screen.
Am I doing something wrong?
I solved the problem, turns out there was a bug in the grunt version I was using, using an older version or manually adding the libraries instead of using grunt worked.
I have installed Cordova along with Phonegap and installed node.js in my system(ubuntu)
by using following commands:
Install Nodejs http://nodejs.org/
Install Cordova 3.0.x
$ sudo npm install -g cordova
Install Phone Gap 3.0.x
$ sudo npm install -g phonegap
Then i created project using phonegap command:
$ phonegap create hello
Trying to run into my local by using following command:
$ phonegap local run andriod
Now at first i am getting following error:
shoaib#shoaib:~/Documents/hello$ phonegap local run android
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project. /home/shoaib/.cordova/lib/android/cordova/3.0.0/bin/create: line 54: jar: command not found
This i solved by running following command:
ls -la /home/shoaib/.cordova/lib/android/cordova/3.0.0/bin
Now when i again run
$ phonegap local run andriod
I am getting below error:
root#shoaib:/home/shoaib/Documents/hello# phonegap local run android
[phonegap] compiling Android...
[error] An error occurred while building the android project. /bin/sh: 1: /home/shoaib/Documents/hello/platforms/android/cordova/build: not found
I am using Android SDK 17
and version as 4.2.2 .
Any solution for this issue?
I had a similar problem. build and run were missing along with a few other files and lib was an empty directory. Downloaded cordova-android from here extracted and copied everything from its /bin/templates/cordova/ to the project (/platforms/android/cordova/). Then I could build and install the app.
Still had to start the emulator, check the running emulator with platforms/android/cordova/lib/list-started-emulators and then pass it when installing or it would take forever to install it on an emulator.
$ platforms/android/cordova/lib/list-started-emulators
emulator-5554
$ phonegap install --emulator=emulator-5554 android
I had already installed the JDK but the same error.
To fix this I just removed the phone test project and make sure that:
Java, javac and jar where in the path
(both should work)
java -version
javac -version
jar -version
Android sdk path was properly set and JAVA_HOME environment variable was properly set.
Then I remake the project and everything worked.
Hey got the solution.
I install open jdk 6.0 and problem is resolved.