How to permanently install an app in React Native - javascript

npm start
Select a - for android
However, with this, you only have the app running temporarily and have to do it repeatedly to launch it.
Is there a way to permanently install an app by Build -> Install like on Android Studio?
Thank you all in advance.

Well if you wish to permanently install the app on your phone, you will have to generate a production build (.apk file) and install it on your phone.
npx react-native run-android --variant=release
Read this for more clearity regarding builds.

It's unclear if you want to install it to your physical device or not.
In android studio you can press "Build" in the menu and then select build variants, change "app" to release.
Similarly in xcode, you can select build configuration to be on release.
Then you just build the project and you will have a release version of the app on your phone.

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.

React native init android,ios and app folder missing

Missing android,ios & app folders and index js files
I'm using react native v 0.1.10 in windows 7 OS
We can generate android and ios folder by using upgrade
Run react-native upgrade to generate /ios and /android folders again.
Run react-native link for any native dependency. (if needed)
Finally run
react-native run-ios
or
react-native run-android
Probably you created your project using create-react-native-app, which is an even more simplified toolchain.
You should probably eject if you need android/ios native configs or something.
Please take a look at this doc: https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md
Try this to generate the Android and iOS folder without change version
react-native eject
react-native link
Install a new file using powershell instead of cmd.
Run following commands
1. npx react-native eject
After running above command you can see output in console as follows
info Generating the iOS folder.
info Generating the Android folder.
Next below command
2. npx react-native run-android
Try update ur nodejs and npm to the latest version then run everything again starting from init
npm run eject
next we will get some couple of questions,
? how would you like to eject from create-react-native-app
React-Native : I'd like a regular react native project
? What should your app appear as on a users's home screen? _Your wish____
? What should your Android Studio and Xcode projects be called? rncourse
After Ejected Successfully the project structure will change, added folders android and ios.
happy coding

ionic doesn't install app

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

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