How to install ionic app in android device through terminal? - android

I am developing an ionic android app and it generates the output apk file inside
project->platforms->android->build->outputs
Then inorder to test the app, i am forced to manually copy the apk file to my device to install app on it. So is there any way by which i can directly install the apk in my device when i build the ionic project through terminal? In android studio, the app get installed on the device when we run the project. I am looking for same kind of methode with ionic.

I suppose you are running ionic build android.
You need to run the command ionic run android.
If your ANDROID_HOME path is correctly set, it will run in your connected device or if no device is connected, it will start your android emulator device.

You can also run this command ionic run android --device. If your ANDROID_HOME path is correctly set, it will run in your connected device as well.

Related

ionic cordova run android --prod events not working properly

I have installed ion2-calendar in my ionic application using npm install ion2-calendar moment --save and i have made some changes on its files located in node_modules/ion2-calendar/dist/components/month.component.js, i have added (panEnd) and (panStart) in its dates.it is working good using ionic serve and ionic cordova run android.but the events are not working when we make build usinng --prod option like
ionic cordova run android --prod
the build was successfull and we can run the app on mobile,but the added event does not works.is there anything we need to do to add this changees in production build?
I had the same situation but I solved this doing this step and rebuilding the project for production.
try production build commands
after removing local page module file (i.e login.module.ts) of each of your page!
I mean do this
To
NOTE!! if that does not work for your do post your logs by testing your device logs using
CHROME DEV tools. you can inspect device logs there using
chrome://inspect/#devices
make sure you are using ADB drivers for your android on your machine!
you won't require this for IOS though you can directly check your log commands in XCODE Console!

How to convert the ionic project in to android app

i had build the ionic project (sample in 'www' folder) and run the sample in browser. but i need to convert the sample/project in to android app, and want to test that sample in my android phone. please provide what are all the software needed to do this and what are all the step by step procedure.
You will need the Android SDK to compile Android code. Set ANDROID_HOME environment variable to the SDK location.
On windows: set ANDROID_HOME=/path/to/sdk
From the command line, run the following command which generates an Android project:
ionic add platform android
Then build an apk file using this command:
ionic build android
Copy the apk to an Android device for testing.
The next step after starting an ionic project and building the app is deployment.
Make sure your device connected to your machine. Make sure android ionic support is enabled via $ionic platform add android. Check that android is supported via $ionic platform list.
Then build your app.
$ionic build android and run it $ionic run android
This should run to the connected device to test. You can also use emulators by adjusting the run syntax.

Install specific apk

I am doing an Ionic project. Also I have added Crosswalk. So when I run ionic run android, android-debug.apk is installing in my phone. But I need to install the Crosswalk app (means android-armv7-debug.apk).
Is there any way to install this app by using the command ionic run android instead of copying this file?
Thanks
I don't know if this is possible with an ionic comand.
But you can do this.
ionic build android
adb -d install /path/to/file/android-armv7-debug.apk

Error while running for mobile platforms: Error running cordova.sh Current working directory is not a Cordova-based project

I followed the instructions on https://www.meteor.com/try/7 in order to properly install the android sdk for meteor. Although I was able to properly install it, I can't get it to work.
When trying to start the android emulator using meteor run android it throws me an exception:
Error while running for mobile platforms: Error running cordova.sh
Current working directory is not a Cordova-based project.
Edit
The same applies to the ios simulator when trying to run it using meteor run ios
You need go to your directory first and run the command.
cd your_cordova_project_path

Error creating android subproject when using phonegap run android command

I installed nodejs and did the following:
npm install -g phonegap
phonegap create <app path>
cd <app path>
phonegap run android
when i execute the run android command, I get below error:
An error occurred during creation of android-sub project. The system cannot find the project specified.
not sure where this is coming from.
any clues.
Thanks
Had the same problems and a hard time finding a solution, however:
Make sure JAVA is installed
Set JAVA_HOME & PATH variables
Make sure ANT is installed
Set ANT_HOME & PATH variables
Make sure Android SDK is installed
Add PATH to sdk/tools
Add PATH to sdk/platform-tool
Run SDK manager to update & install SDK elements
Run AVD manager to create a default emulator image
Install NodeJS (with PATH)
Follow the usual tutorials
npm install -g cordova
cordova create hello com.sample.hello HelloWorld
cd hello
cordova platform add android
cordova build
now launch your Emulator
cordova emulate android (patience, take ages...)
or
cordova run android
much faster, just make sure you mobile device is connected, on, unlocked, usb debug is on, and drivers are installed
if you can't find one try: sdk\extras\google\usb_driver
npm install -g phonegap
phonegap create hello com.sample.hello HelloWorld
cd hello
phonegap platform add android (if not working use cordova command)
phonegap build android
now your launch Emulator
phonegap emulate android (patience, take ages...)
or
phonegap run android
much faster, just make sure you mobile device is connected, on, unlocked, usb debug is on, and drivers are installed
if you can't find one try: sdk\extras\google\usb_driver
I think the main difference between phonegap/cordova, is phonegap (which belong to Adobe) has the possibility to build in the cloud via https://build.phonegap.com/
Whitespace is not allowed i would say

Categories

Resources