How to run exsicting ionic app - android

I have an Ionic app with this folder structure
How can I run this app, knowing that I have node and ionic npm installed in my PC

Type ionic serve to run your app on the browser

Follow steps below:
Open command prompt in windows and goto your app folder using cd command in cmd.
Once you're in, just write ionic serve to see app running in browser.
To run it in device, first build it using ionic platform add android Then ionic build Next ionic run android
It will run application in connected device or emulator.
Make aure you have android setup in your system for this.

You don't have www folder. It's a folder where your html and js and css files are. Without it you don't have an app.
I recommend creating entirely new ionic project with ionic start ProjectName
Then you will be able to run it with ionic serve and see the structure so you can figure out how to run your example

In you have this inside your src folder
css
img
js
lib
index.html
just rename src to www and then run ionic serve.

Related

Issue in converting an Angular 8 app to Android using Cordova

I am trying to convert my existing Angular 8 app to an android app using Cordova.I am following this tutorial.
But, I am getting a white screen when I install the signed and release build in a Android device.Any suggestion?
The following steps work for me
Install cordova globally
Go into the Angular project folder and run this
cordova create mobile
If there is not a folder inside your Angular project
folder called "dist", run this:
ng build
Change directory
cd mobile
Link the dist file with the www file. Run this command in cmd
as administrator
mklink /d "C:\Users\....\www" "C:\Users\....\dist"
Go to the parent directory (you should be in the Angular
project folder now) and run this:
ng build
Go to mobile\www\index.html and do this change
<base href="/"> --> <base href="./">
Go to the mobile directory (cd mobile) and run this
cordova platform add android
Connect the android phone and run this
cordova run android

Deploy working polymer app to android using cordova

Yes,We have resources for this on net and I searched for that ,But it didn't solve my problem so asking this question here.
I have a working polymer web app and I am able to access this using http://localhost:8080//index.html,My app looks like this
I want to deploy this app in android phone,So I used apache cordova
Below are the steps I followed
Installed cordova using
npm install -g cordova.
create cordova project
cordova create alertsDir com.alerts.net "Alerts" --template=C:/Users/212606402/Learning/Alert client/alert-push-notification-client
cd to alertsDir and add platform
cordova platform add android
build platform
cordova build android
run project
cordova run android
I am not getting any error in above steps
I run this in both android emulator and nexus 5 devise but it showing the same default cordova screen,My app is not shown there,Below is the emulator screen I am seeing
I followed some tutorials and just wondering how it works for them.
tuetorial 1
Can anyone please explain me what I am missing or doing wrong.Thanks in advance.
as far as i know, Cordova only deploy 2 folder platforms folder and www folder but not all in platforms folder will get deployed to your device, usually the cli will merge platform_www and www folder.
so if you want to make a cordova app you need to put all your sourcecode or sourcecode that already bundeled using either polymer-build with gulp or polymer-cli inside www directory.

how to run sencha app on a physical device

I want to run my sencha app on an android tablet. I wrote "sencha app build" to compile it. And the compilation was successfull. But now how can I run it on my tablet?
Follow below steps :
Run command sencha app build production. It will create production build inside build folder.
You can use either cordova or phonegap,i am using cordova,you can install it by below command.
npm install -g cordova
Create a cordova app in another directory.
cordova create scraper com.test.scraper Scraper
Step 3 will create a directory scraper, Now execute below command in sequence's.
cd scraper
cordova platform add android
Now copy the build\production\scraper\ folder data(from step 1),Ex :-(your_app_name)\build\production\scraper\ to cordova app www folder.
Now run cordova app build android
Step 6 will create apk file inside *platforms\android\ant-build\* folder.Now you can install this apk to your android tablet.
For more Information,you can refer :-
http://www.sencha.com/forum/showthread.php?270566-Building-Sencha-Touch-2-Phonegap-Application-for-Android-Windows/page2
http://cordova.apache.org/docs/en/3.6.0/guide_cli_index.md.html#The%20Command-Line%20Interface

Cordova CLI Command

Iam new to phonegap/cordova and got a general question.
Yesterday I created a test app and today i wanted to test it on my device. First i started local server with "cordova serve android" and then deployed it on m,y device via "cordova run android --device". Everything worked but my testapp www directory got replaced with cordova default direcotry. May it be that commands like "cordova run android --device" or "cordova serve android" overrides the existing www direcotry in my project folder and replace it with default one?
Thanks in advance!
Do you mean that your www folder inside platform folder got replaced? or the folder just inside your project got replaced?
You need to put your code in this folder yourprojectnamedirectory->www and after you provide this command cordova run android, that code will be posted inside all platform folders automatically and run on the device. Hope I made it clear.

why $cordova prepare when use a new phonegap-cordova api(plugin)

Im new with phonegap, cordova and android. Im on mac, recently i install all the needs:
Phonegap 3.3.0-0.19.6
Cordova 3.3.1-0.4.1
Got Android SDK and running on eclipse with no problem. Then create a new Android application on eclipse for phonegap successfully, and running on a phone with android.
Then i create another app with cordoba(terminal), put 2 platforms android and ios, i run prepare etc.. and then import the project(android) into eclipse. At this point the app runs ok, so i proceed to install some plugins for testing (Notifications and Device)
https://cordova.apache.org/docs/en/3.0.0/cordova_device_device.md.html#Device
When i run the app with eclipse the examples always return
Uncaught TypeError: Cannot call method 'alert' of undefined
And its the same with device. So looking over the internet i found that if i run $cordova prepare will work, then i run the command, then run the app on eclipse and it work but always when i install a new plugin for testing i have to run cordova prepare, and the problem is that index.html rewrite with example hello world and i loose my code.
Any help over here, im doing ok?, how to install those plugins and make the test and dont have to run prepare all the time. (Please think on eclipse, i dont what to use terminal all the time)
I had the same exact problem and other posts suggestions didn't work for me.
I solved it by switching the steps a bit, despite the official docs and other posts.
If I add ALL the files AND the core plugins BEFORE I add the platforms, then adding the platforms takes these things with it into the new folder structures AND only build once from the command line before I open the project.
If I need to add anything I do it again. Although I can edit the www files without going through the process again, I do not expect the root www to perpetuate the platform www's. I just copy it myself into all the www folders. It shouldn't be this way but I think this is a well documented bug with multiple command line builds, for now and thats my working fix.
The recommended way is to edit html/js/css... in the root www folder of the project, not in the platfotms/xxx folders.
The reason is that if you have multiple platforms, you just need to modify in one place and cordova prepare or cordova build or phonegap build will propagate your code to all the platforms and update plugins.
If you have only android platform and want to be able to change code directly in eclipse for the platforms/android/assets/www folder, I suggest you create a shell script to
copy all the content of projectroot/platforms/android/assets/www to projectroot/www
run cordova prepare android
Then, instead of running cordova prepare android, you'll just have to run your script after you add new plugins.
Edit
I think there may be a better way for your problem.
You should be able to use plugman to install your plugins instead of cordova.
First you need to install plugman cli : npm install -g plugman
then install a plugin using
plugman -d --platform android --project projectname --plugin nameorurlofplugin
http://cordova.apache.org/docs/en/edge/plugin_ref_plugman.md.html
I had these issues too.
One approach I use now is:
Edit the index.html in the platform folders which is platform/iOS/appname/www and so. Then add plugins using the normal terminal way using cordova plugin add but always run the project using Xcode for iOS and eclipse and not from the terminal because then you will lose your code.
From my experience when you run using .xcodeproj or say android project the www on the inside is used and if you use cordova run ios from terminal the www on the outside will overwrite the www in the platform folders.
If you get xcode errors saying can't find so and so plugin files just move them to the path the error says xcode expects them to be in.

Categories

Resources