Reputation: 845
I have been learning React Native for a while by watching video tutorials. The instructors are teaching how to code and run the project in simulator but no one ever mentioned or showed how to publish the local projects as a production app. I researched and checked official React Native documentation but I could not figure out how to publish
The question is how can I make a downloadable, installable single file mobile application to use in my mobile phone.
Please, share any useful video tutorial or documentation. Thank you in advance.
Upvotes: 2
Views: 12983
Reputation: 3671
ANDROID
You must generate a private key by running
$ keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Then you have to set the generated file my-release-key.keystore
under android/app
in your project.
Edit the file ~/.gradle/gradle.properties
as following
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=[YOUR PASSWORD]
MYAPP_RELEASE_KEY_PASSWORD=[YOUR PASSWORD]
Now edit android/app/build.gradle
as following:
android {
...
defaultConfig { ... }
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
release {
...
signingConfig signingConfigs.release
}
} }
And in your terminal run cd android && ./gradlew assembleRelease
Your APK will be generated inside this directory android/app/build/outputs/apk/
as app-release.apk
To install it in your device, run: react-native run-android --variant=release
More info in the official docs: https://facebook.github.io/react-native/docs/signed-apk-android.html
IOS
You must have an Apple Developer Account https://developer.apple.com/account/
Open Xcode and sign in with your developer account
Build your project
From toolabar Select Product > Archive
Click on Validate
Click on Export
Download IPA file
From toolabar Click on Xcode > Open Developer Tool > Application Loader
Click on Deliver App
Select the downloaded IPA file
Wait a few minutes and your app will be available on AppStore Connect
From there you can use Test Flight to distribute your app to a test team.
Download Test Flight App in your device
After you set up a test team, all testers will be available to download the app through Test Flight
More info here: https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html
Hope it helps
Upvotes: 12
Reputation: 686
You should generate a Signed APK file for android while publishing on Play store.
Click here to see full instruction of how to create signed APK file.
For iOS Click here
Upvotes: 0