React Native Expo publish to Android - react-native

I built a test application using react native. I'm trying to publish it following this tutorial: https://facebook.github.io/react-native/docs/signed-apk-android.html
However, my project does not have folder android. How can I create this folder?

In React-native, there are two method to create Singed APK File
First you should know
it's best to create apps using react-native init rather than expo as React-Native-Cli gives you local project for both ios and android,you can test and debug the code locally and also use the tool to publish applications
- If you create the project by using this command -
react-native init Project_Name
Then follow this method.
BUT IN YOUR CASE
you're using expo and also expo-cli! that's good! but when i use expo i usually like to go with expo XDE which has single version to publish,render or debug with it's own console in the bottom and that'll help you upload your code to expo server where you can ask them to render app for iOS or android and they will return you a link which will download the APK or the ipa file for android or iOS respectively
Here is the documentation link which'll explain you each step one by one and do keep an eye on the notes and TODOs while following the step (in your scenario)
- If you use expo,for create React-native project
then follow this method generate the singed APK file for Android - Expo

Related

Expo React-Native App doesn't work when run as a standalone APK

My Expo-based React Native App works without a problem when run in the Expo tool but gave the following errors when built as an APK to be installed and run standalone.
A series of white screens keep flipping before the blue screen comes up.
Here are my App.JSON and Package.JSON files
Package.json
App.json
And here are the screen capturing the error message.
Actually there are two ways to create a React Native application
create-react-native-app (CRNA)
react-native init
As you stated in comment section, You created your project using CRNA
CRNA will gave you some form of solid project structure, which is really useful for beginners to get started with react native, you code the app with pure javascript and the app will work inside Expo.
Now if you want to take build and run as a standalone apk for android,
There are two methods
You can run command: exp publish:android
You can eject your app from expo
Dont use exp publish for standalone apks,
You can use second method:
To eject your app:
First if you dont use any expo apis inside your apps, it is very easy to eject and build as a stand alone apk.
just do yarn eject
This will gave you some instructions and follow that.
After that your CRNA project structure will be converted into react-native init project structure, now you will be able to see "Android" and "iOS" folders inside your application
To take build Run: connect your phone with USB debugging ON and react-native run android.
That's all.
Solved my own problem. The 'eth-lightwallet' library works perfectly within the Expo development tool but when I build into an APK, it just made the white screen turns up with no meaningful error messages.
The solution is to replace it with a pure web3js implementation.
This may be useful if you are developing a mobile app for Ethereum.

Converting project to react native init

Firstly I created my project with create-react-native-app and I'm developing my app with npm start and I have expo installed on my emulator. How can I convert these project into react native init, I don't want to use expo anymore...I don't neeed any api-es from them...
Thank you
The best resource for this is in the create-react-native-app repository. Try having a look here to get started.
The short answer is to use npm run eject
If you have experience generating signed APKs for Android and code signing with iOS then you shouldn't run into too much trouble.
If you don't, then take the time to go through the Android docs and also this guide should help you get up on running on iOS as well.
Good luck!
Instead of creating your project using the command create-react-native-app, you may create a react native project by following "Building Projects with Native Code" of the getting start guide: https://facebook.github.io/react-native/docs/getting-started.html.
Here you will find out how to:
1. Set up the environment.
2. Installation of phone emulator.
3. Connection of your phone via USB for testing.
4. Create a project using the react-native init command.

How to generate signed apk and deploy to google play store

i am using create-react-native-app
there is no android / iOS folder
how to generate signed apk and deploye to google play store
Here are the instructions for create-react-native-app app deployment.
https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md#sharing-and-deployment
If you want to build and deploy your app yourself, you'll need to eject from CRNA and use Xcode and Android Studio.
This is usually as simple as running npm run eject in your project, which will walk you through the process. Make sure to install react-native-cli and follow the native code getting started guide for React Native.
Generating key
https://facebook.github.io/react-native/docs/signed-apk-android.html
If you don't see android/ios folders in your directory. Then type in your terminal react-native upgrade then react-native link

Can I not use Expo (cloud service) at all using React Native

I have build an app using react native(detached) but the thing is I would want to completely get rid of Expo. The reason is, what if one day EXPO service get shut down or no more supported.
So in this case I would not want the app to be affected.
Currently I need to publish my app thru ExpoKit to see the latest changes, how would I build my android app so it would not have any reference to Expo but still be able to work properly
Currently this is how I understand how the react native and expo works: first u build ur app using react native code and then a bundle.js is generated somewhere on cloud(EXPO) using publish command so the app communicate with that bundle.js.
Note I am not using any feature from Expo so why would I need Expo in this case?
Edited: If I am detaching my app from expo, I mean why would I still need Expo? Can't I just build the app and run the app without expo at all?
You can build your whole application without using expo, just follow the steps from facebook documentation in "Building Projects with Native Code" tab.
or
you can run "npm run eject" in your project root directory folder.
After this, you can build your appliaction using react-native cli commands, like
react-native run-android.
edited :--
For building apk for production, you can follow steps given in facebook documentation as generating signed apk and for released IPA for iOS yo can follow building your app for production for IOS.

how to run react native code from server? i want to release app in android and apple store

I am an android developer and learning react native.
I made an app in React Native and now I want to release my app in android play store and apple store but I don't know where do I put my react native project code/files?
I had put react native code in my PHP(Linux) server but it's not working, it says file not found 404.
please guide, Thanks
You need to generate build standalone signed apk.
Generating Signed APK
https://facebook.github.io/react-native/docs/signed-apk-android.html
1) first create keystore file and put in android folder location
2) setting up gradle for keystore
3) run comman
react-native run-android --variant=release
after success run command you will file apk-release.apk in andorid/app/build/outputs/apk/ location
then you can uplaod apk to app store
If your app doesn't need detach (for example doesn't use bluetooth) you can use create-react-native-app and put your app code inside new project. That way you can publish your app to https://expo.io/ . It's a great way to publish your app without Google Play and App Store.
Here is instruction for creating new react native app with expo kit:
https://facebook.github.io/react-native/docs/getting-started.html
And here is how to publish it into expo:
https://docs.expo.io/versions/v25.0.0/guides/publishing.html#how-to-publish
All you need is create-react-native-app and exp command line tools.