Cordova how to install app directly to Android device? - android

in case that i need to test cordova on app i must do this:
Run cordova build android
Go into android ADT (Eclipse)
Clean the project
And then run from eclipse on device.
Exist some less time consuming plugin or script for this?
Thanks for any advice.

You should be able to just do
cordova run android
from the command line. See here: Cordova Command Line docs

Related

cordova platform add android not working, how can compile using cordova? Ionic project

I'm running this line command
cordova platform add android
To start compiling the app APK, but the following error appears on the command line
I don't understand why the cordova command isn't working, what could it be?
if its not already done, to run this command first :
ionic cordova prepare android
https://ionicframework.com/docs/cli/commands/cordova-prepare
otherwise, try renaming the android folder, run and the prepare command again. some people experienced the same issue and this work-around worked
https://forum.ionicframework.com/t/could-not-install-from-ios-as-it-does-not-contain-a-package-json-file/168462/5

Cannot Emulate Ionic v1 app to Android Emulator

I am developing an ionic app. And I want to emulate it on real Android device. I already downloaded the Android Studio. I plugged my Android device and when I tried to run this command ionic cordova run android There's a lot of errors.
Note: I am on Windows 8.1 32bit. JDK 32 bit.
This is for an academic thesis.
This is the error:
Have you enabled usb debugging on your device? You'll have to enable developer mode on your Android. Google can tell you how, but you just go to settings/about/build number, tap 7 or 8 times... Then, you should be able to use ionic run android --device. That should build out to emulate so long as you've installed the Android sdk.
It can be solved by removing platforms, then add again.
ionic cordova platform rm android
ionic cordova platform add android
if above solution does not work please run following command,
ionic cordova run android --livereload
If still problem persist,run same command with --verbose options,
ionic cordova run android --verbose
Alternatively , and way faster , you can build your app then drag/drop it inside the emulator (running aside)..it will install quicker and run sleeker.
And you'll have peace of mind , I know this is not what you're looking for ,but still a nice hack if you're time-bound.
I already solved my problem! As we can see in the error that I posted, it is the gradle file! It is corrupted download. What I did is delete the .gradle folder and run ionic cordova run adnroid. In that way, it will automatically download the gradle file! Thanks for the replies by the way!

Build Cordova project on Windows

I am trying to build a Cordova project on Windows using the steps I was given by the team who developed it.
Install Bower, Cordova CLI, Grunt CLI, SASS/Compass/sass-globbing gems
grunt build
cordova platforms add android
Then trying to run grunt emulate android but getting an error. I have the Android SDK installed and can fire up an emulator but I'm getting the following when trying to run that command:
Warning: Task "android" not found. Use --force to continue.
What am I doing wrong? I'm new to Cordova/PhoneGap development and all this interplay between packages is daunting.
You probably should run
cordova run android or grunt emulate:android
First part with cordova CLI should run all the time, and no need to use Grunt to launch application, if all assets are prepared.
Grunt part is just a guess work based on how I would organize Gruntfile.js and I could be wrong here. Without seeing more details, hard to tell you more.

phonegap/ Cordova error: [RangeError: Maximum call stack size exceeded]

I am trying to create a phonegap / cordova app using the 3.1.0 version.
Created my app with the command:
cordova create hello com.example.hello HelloWorld
And after running this command:
cordova platform add android
to add android platform, i am getting:
[RangeError: Maximum call stack size exceeded]
Any idea what could be the issue?, previously i created another app, but same error was occurring when adding camera plugin.
I faced the same issue, but I was actually issuing the command in wrong directory, so firstly I changed the directory to Hello then issued the command.
So, I have directory structure as,
---Cordova
---Hello
and I was actually issuing the command by being at Cordova folder. After that I changed the folder to Hello then executed this cordova platform add android and it worked.
Please check once
be sure you are located in the created directory (Hello, I guess), the same level with .cordova
cd Hello
For anyone coming to this question after July 2013 (when Cordova 3.0.0 was released), there is another reason for this problem.
If you created a Cordova project on a computer with Cordova 3.x and you are trying to work with it on a computer that still has the old 2.x version, you will get this error because of how the project structure changed between the versions.
Upgrading Cordova to the newest version using npm install -g cordova will fix the problem.

How to Build and run the cordova project with eclipse and run project for android

I have created the project with cordova CLI but i do not know where i need to change and how to run the cordova android project with eclipse for each platform. Thanks for helping
Before run the android project inside your Cordova Project you should know these things.
If you are making any changes in the Cordova Project then first you need to prepare the cordova. use the command cordova prepare
Then it changed in your config.xml (for android) automatic as you added or any changes you made. Do not make any change in your android project which exist inside your Cordova project. You can only make change inside the www folder of your Cordova project. And after made changed you need to make cordova prepare every time.
After prepare the cordova you can run the android project on device or emulator. For this you make sure you have made the path of android sdk for platforms-tools and tools in your environment system. If you not configure this path and add this two path in system environment .
Now run the android project on device use command cordova run android and run on emulator use this command cordova emulate android.
And if want to run on eclipse then you should import this android project of your workspace in eclipse. But if you again made changes in your cordova project then need to delete and again import the android project this switching happened every time so better to run through CLI.
I hope you got all things
Sunil's answer is good. I would like to add logging using Android Debug Bridge(adb).You may want to run:
adb logcat on a seperate shell window for logs after running cordova run android you need when you run into errors.This will produce huge logs, so I would recommend using:
adb logcat|grep Cordova

Categories

Resources