ionic doesn't install app - javascript

I'm trying to simulate my app on ios simulator with ionic. But when I run:
ionic build ios
ionic emulate ios
My app doesn't appear on the simulator. What should I do?

You need to install IOS-Sim tool.
The ios-sim tool is a command-line utility that launches an iOS application on the iOS Simulator.
Apply this command on terminal window:
$ sudo npm install ios-sim -g

Make sure that you have added the iOS platform to the project and verify that you have the iOS-Sim tool. If this is the problem you should a message that you are missing any of those two in the terminal.

if you are using visual studio, you need to configure the remote ios agent.
follow this documentation https://msdn.microsoft.com/library/dn757054.aspx#ios to configure and test you application

Sometimes, an ionic app can take a really long time to load on the simulator. First try waiting.
Second, if it still doesn't load, know that the simulator is a lot pickier about what it will run and not run than the browser. Check if you app works in the browser. Try a different browser (such as Firefox). If it does not, debug from there. If it does work in the browser, run your code through a linter to find that one semi-colon that your browser didn't care about.

Try start do it on xcode(in each my ionic/cordova project i have to use some native solutions to build application for iOS i use xcode for android i use android studio)
I know that different platform need some hours of adapt but this knowledge is very important

Try remove and add platform again.
ionic platform rm ios
and
ionic platform add ios

simply use following commands to build and run your ionic app respectively.
ionic cordova build ios
ionic cordova run ios

Related

How do you deploy React (non-Native) app to Android?

I've created a React app that looks great on mobile, but rather than a user just visiting my website URL I also want them to be able to install it as an apk through the playstore.
Is there any trivial way to port it to Android, that would allow me to continue to develop just one version of the app? I looked into porting it to react-native, but much of it would need to be recoded. I also considered just opening the app URL in a browser popup, but I'm wondering if there's a better way.
Thanks -
Edit: Based on Michael's comment, I'm trying out turning my app into PWA compliant, then using Capacitor to deploy on Android & iOS. I'll see how this goes and write my own answer if this works out (and no one else answers =o)
Forgot about this question. As the OP in 2021, I resolved this by using Capacitor - A Javascript library that converts your app to Android and iOS builds.
Install Capacitor: npm install #capacitor/core #capacitor/cli
Initialize it: npx cap init
Add Android and (optionally) iOS support: npx cap add android npx cap add ios
Create an Android app: npx cap sync
Open Android Studio with your new app (to build a .APK): npx cap open android
Optional: Open Xcode to build an iOS app: npx cap open ios
Source: https://capacitorjs.com/docs/getting-started

Capacitor (build.gradle does not exist/operation not permitted) React app to Android can't build

I can't build my react webapp to android using capacitor (never done it before). However, I successfully did so to ios.
I've tried to sync gradle manually from android studio (file > sync project with gradle files), but still no luck.
These are the errors (steps to reproduce are included below):
12.41 Gradle sync failed: /spacex-launches/node_modules/#capacitor/android/capacitor/build.gradle
(Operation not permitted) (54 s 634 ms)
The main question here is, (Operation not permitted)
I've tried to allow all access for everything (read and write) for everyone for every file in the folder. Still, again, no luck.
The commands I ran to reproduce these errors:
npx cap init
npx cap app (then I picked android)
npx cap open android (it tried to sync and then gave me the errors above; thus build is not possible).
Any help would be appreciated!
Thanks a lot.
Turns out, opening the android folder manually using Android Studio, weirdly enough fixed it.
Assuming your source code is in a remote repository somewhere, try a fresh install in another directory. First, update the Ionic CLI.
npm i -g #ionic/cli#latest
git clone https://.../your-app.git
cd ./your-app
npm i
ionic build
ionic cap add android
ionic cap open android
Note you don't need to run npx cap init again. Since the iOS build is working, Capacitor is already installed in your project.
If you still can't build, ensure your environment is set up correctly. This can vary whether you are on Mac or Windows. The Capacitor docs provide guidance.

What does cordova prepare and then run vs cordova platform add and then run?

I checked the documentation but didn't find a clear explanation about when to use those commands:
cordova platform add android && cordova run android
cordova prepare android && cordova run android
In the documentations the run command does this:
Run project (including prepare && compile)
run is already running prepare. So, is there any case where I need the option 2? To me it looks like it doesn't make sense if I'm using run after that.
Thank you in advance for your valuable time : )
Adding a platform in Cordova does not run the prepare command which will run hook scripts.
Assuming the android platform is not already added, this will generate the directory platforms/android and populate it with a complete standalone Android project. Cordova plugins that have been installed will also be installed into the Android project. cordova run android will run cordova prepare android followed by cordova build android, then proceed to install and run the application. If the android platform is already added Cordova will throw and error.
This command is redundant, and, assuming the android platform has already been added, will run cordova prepare android twice followed by cordova build android, then install and run that application. If the platform is not added Cordova will throw an error.
Conclusion
It makes little sense to differentiate between the two command sequences you provided as they seldom need to be executed. You usually only add a platform once, and you can just call cordova run android without needing to call cordova prepare android before it unless you intend to use cordova build android manually (potentially as a signed release) followed by using adb or saving/deploying the generated APK without needing to do a full blown run.
Regarding option 1, if you already have one android platform, it will fail due to
"cordova platform add android" command and not "cordova run android"
Regarding option 2, even if there is no android platform,it will work
Tried with cordova version = 10

testing for ionic-cordova- not working in browser

I am new to Ionic. Ionic uses cordova plugins for implementing different functionalities. If there are no cordova plugin dependencies, then we can view output in browser and view the errors in browser console. If cordova plugins are used, then browser does not support the native plugins and it is not possible to test for errors in browser. Is there any best tool for debugging and testing for errors for these kind of projects. Thanks in advance.
It is always better to test on real devices or at least emulators. Nothing replaces a real device.
But if you want to test in the browser and you have plugins that you want to be loaded you can add the browser platform.
ionic platform add browser
ionic run browser
This is different from 'ionic serve'
if you are using cordova add sudo ionic cordova run browser, if you'd like to run it in your browser. And use sudo ionic cordova run browser --livereload which would apply updates while you are making changes to the application. Though, typically it's not good practice to apply sudo, as module dependency lack privileges to install sub-dependencies, which can later become troublesome if there are package updates. Hope that helps.

Run a React Native app without launching Xcode?

Can an iOS app (built entirely with React Native) be built/run from the command line? PhoneGap has a nice ios-sim utility for doing just that, but I haven't had any luck with it.
If you build the project once using Xcode, then you can close it, run npm start in your project root (to start the packager), fire up the Simulator (maybe using ios-sim). Since you built it once in Xcode, the app will be installed in the simulator so you can just run it and the whole CMD+R refresh process will work.
Fire up the server with:
$ npm start
Build/run the app in the ios simulator:
$ react-native run-ios

Categories