Building, Publishing & Deployment
10 min read
Course: React Native
Topic: Building, Publishing & Deployment
Hey there, future app mogul! π You've coded, you've styled, and you've debugged. Now it's time for the grand finale: getting your masterpiece out of your development environment and into the hands of users worldwide. This part of the journey can seem like a labyrinth of rules, certificates, and weird configuration files. But don't you worry! We'll break it down, step-by-step, and make it as painless as possible.
Let's get this show on the road!
1. Preparing App Icons & Splash Screens π¨
The Problem: When users install your app, the first things they see are your app icon on their home screen and a splash screen when they launch it. A default icon and a blank loading screen scream "amateur hour." You need to create a strong first impression.
The Solution: You need to design and configure custom icons and splash screens that reflect your app's brand and provide a polished user experience from the very first tap.
What are App Icons and Splash Screens?
- App Icon: This is the small image that represents your app on the user's home screen and in the app stores. It's your app's face to the world.
- Splash Screen (or Launch Screen): This is the screen that appears for a brief moment while your app is loading in the background. It prevents the user from staring at a blank screen and makes the app feel more responsive.
Hands-On: Creating and Configuring with Expo
Let's assume you're using Expo, which makes this process wonderfully simple.
Step 1: Create Your Assets
First, you'll need to create your images.
App Icon:
- Size: Create a high-resolution square image. A size of 1024x1024 pixels is perfect.
- Format: Save it as a
.pngfile. - Design Tip: Keep it simple and recognizable. Don't use transparency; the operating system will handle rounding the corners.
Splash Screen Image:
- Size: While you can use a large image to cover all screen sizes, a common and effective approach is to have a centered icon on a solid background color. A 1024x1024 pixel icon works well here too.
- Format: Use a
.pngwith a transparent background for the icon.
π Fun Fact: Back in the day, some developers would make their splash screen look like the first screen of their app, but with fake, disabled buttons. This "perceived performance" trick made the app feel like it loaded instantly. Sneaky, right?
Step 2: Add Assets to Your Project
- Create an
assetsfolder in your project's root directory if you don't have one. - Inside
assets, create animagesfolder. - Place your
icon.pngandsplash.png(your splash screen icon) insideassets/images.
Step 3: Configure app.json or app.config.js
This file is the control center for your app's metadata. Open it and add or modify the following properties under the expo key:
{
"expo": {
"name": "My Awesome App",
"slug": "my-awesome-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
// ... other properties
}
}"icon": Points to your app icon file."splash": This is an object to configure the splash screen."image": The path to your splash screen icon."resizeMode": "contain": This ensures your icon fits nicely in the center without being stretched."backgroundColor": The background color of the splash screen.
And that's it! When you build your app, Expo will automatically generate all the different required sizes for both iOS and Android.
2. Configuring App Permissions & App.json Metadata π
The Problem: Your app might need to access the user's camera, location, or contacts. You can't just take this data; you have to ask for permission first. Also, your app needs essential metadata, like a version number and a unique identifier, before it can be submitted to the stores.
The Solution: You must declare which permissions your app might need and configure all the necessary metadata in your app.json file. This ensures your app functions correctly and complies with store policies.
What are App Permissions?
App permissions are requests your application makes to access sensitive information or device features. Forgetting to ask or asking for unnecessary permissions is a one-way ticket to user mistrust and app store rejection.
Real-World Analogy: Think of your app as a new roommate. It's perfectly fine for them to ask to borrow your TV (use the camera), but it would be super weird if they started going through your personal mail (accessing contacts) without a very good reason. You have to ask first, and you better have a good explanation!
Hands-On: Configuring Permissions in app.json
Expo simplifies permission handling by allowing you to specify them directly in your app.json.
For Android:
You can add an "permissions" array to the android key. To request camera access, you would do this:
{
"expo": {
// ... other properties
"android": {
"permissions": [
"android.permission.CAMERA"
]
}
}
}If you don't specify any permissions, Expo will infer some based on the libraries you're using. However, it's good practice to be explicit.
For iOS:
iOS requires a "usage description" string that explains why you need the permission. This is shown to the user in the permission dialog. You add this inside the infoPlist object.
{
"expo": {
// ... other properties
"ios": {
"infoPlist": {
"NSCameraUsageDescription": "This app uses the camera to scan barcodes on products."
}
}
}
}Being clear and honest in your description is key to getting the user to tap "Allow".
Essential app.json Metadata
Beyond permissions, your app.json holds other vital information for the app stores.
{
"expo": {
"name": "My Awesome App",
"slug": "my-awesome-app",
"version": "1.0.0",
"owner": "your-expo-username",
"assetBundlePatterns": [
"**/*"
],
"ios": {
"bundleIdentifier": "com.yourcompany.myawesomeapp",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.yourcompany.myawesomeapp",
"versionCode": 1
}
}
}version/buildNumber/versionCode: These are crucial.versionis the user-facing version (like "1.0.1").buildNumber(iOS) andversionCode(Android) are internal numbers that must be incremented with every new upload to the store. Forgetting this is a common reason for rejection!bundleIdentifier(iOS) &package(Android): This is your app's unique ID on the app stores. It usually follows a reverse domain name format (e.g.,com.yourcompany.appname). Choose it wisely, because once you publish your app, you can't change it.
3. EAS Build: Generating APKs and IPAs in the Cloud βοΈ
The Problem: To get your app on a phone, you need a special package file: an .apk for Android or an .ipa for iOS. Creating these files locally can be a nightmare. You need specific software (like Android Studio and Xcode), the right operating system (macOS for iOS builds), and a lot of configuration. It's a complex and error-prone process.
The Solution: Use Expo Application Services (EAS) Build, a cloud service that builds these files for you. You just run a command, and EAS handles all the complex stuff on its powerful servers, spitting out a ready-to-install app file.
What is EAS Build?
EAS Build is a service that takes your React Native project, builds it in a clean, consistent cloud environment, and gives you back the final .apk or .ipa file. It's like having a super-smart, always-available computer dedicated to building your app perfectly every time.
Hands-On: Your First EAS Build
Step 1: Install and Log In to the EAS CLI
First, you need the EAS command-line interface (CLI).
npm install -g eas-cliOnce installed, log in with your Expo account:
eas loginStep 2: Configure Your Project for EAS
Run the following command in your project's root directory:
eas build:configureThis command will create a new file in your project called eas.json. This file defines different "build profiles." By default, you'll get three profiles: development, preview, and production.
A typical eas.json looks like this:
{
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
}
}production: This is the profile you'll use for app store builds.development: For creating development builds that include developer tools.preview: A production-like build for internal testing.
Step 3: Run the Build!
Now for the magic. To build your app for both Android and iOS, run:
eas build --platform all --profile productionEAS CLI will then:
- Compress and upload your project to the EAS servers.
- Queue a build for both iOS and Android.
- Ask you about handling your app signing credentials (you can let Expo manage them, which is the easiest option for beginners).
- Build your app in the cloud. You'll get a link to track the progress.
Once the builds are finished, you'll have links to download your shiny new .apk and .ipa files. You can install the .apk directly on an Android device or use the .ipa for the Apple App Store submission.
4. Submitting to Google Play & Apple App Store πͺ
The Problem: You have your .apk and .ipa files. Now what? You can't just email them to Apple and Google. There's a formal submission process involving developer accounts, store listings, screenshots, privacy policies, and a nerve-wracking review process.
The Solution: You need to prepare your store assets, create developer accounts, and follow the specific submission steps for both the Google Play Console and Apple's App Store Connect.
The App Store Submission Journey: A Simulation
Imagine you've built the world's greatest cat photo-sharing app, "PurrfectPics." Getting it into the app stores is like applying for a very exclusive club membership for your app.
Pay the Membership Fee: First, you need to enroll in the developer programs.
- Apple Developer Program: Costs $99 per year. You'll also need a Mac for the final submission steps.
- Google Play Developer Account: A one-time fee of $25.
Fill Out the Application Form (Store Listing): This is where you sell your app to potential users. You'll need:
- App Name & Description: What does "PurrfectPics" do?
- Screenshots & App Previews (Videos): Show off your app's best angles!
- App Icon: The one you made earlier.
- Category: Social Networking, Photography, etc.
- Privacy Policy URL: You must have a privacy policy explaining how you handle user data. This is a huge reason for rejections.
The Bouncer Checks Your ID (Uploading the Build): Now you upload the
.apkor.ipafile you got from EAS Build.- Google Play: You upload the
.apkor.aab(Android App Bundle) directly to the Google Play Console. - Apple App Store: You'll use Apple's Transporter app on a Mac to upload the
.ipafile to App Store Connect.
- Google Play: You upload the
The Review Committee (The Dreaded Review Process):
- Once you hit "Submit for Review," your app goes to a team of reviewers at Apple and Google. They will install your app on a real device and check it against their guidelines.
- Common Reasons for Rejection:
- Crashes or bugs.
- Incomplete information or placeholder content.
- Requesting permissions without a good reason.
- Mentioning "beta" or "test" in the app.
- Broken links (especially the privacy policy link).
- Not following design guidelines.
- Simply not being useful or being too similar to your website.
The review process can take anywhere from a few hours to a few days. If you're rejected, don't panic! They'll send you a message explaining the reason. Fix the issue, increment your build number, and resubmit.
π Congratulations! If you pass the review, your app will be published, and you can finally share your creation with the world.
Extra Reading & References
- Expo Documentation:
- Official Publishing Guides:
- App Store Guidelines:
Challenge
You are the lead developer for a new social media app, 'ConnectSphere', and it's time to prepare it for deployment. Your task is to correctly configure the app.json file with all the necessary metadata for a production release on both the Google Play Store and the Apple App Store.
Requirements:
General Metadata:
- Set the app's display name to
ConnectSphere. - Set the URL-friendly slug to
connectsphere. - The initial public version should be
1.0.0.
- Set the app's display name to
Visual Assets:
- The app icon is located at
./assets/icon.png. - Configure the splash screen with the image at
./assets/splash.png. It shouldcontainthe image within the screen dimensions and have a white background (#FFFFFF).
- The app icon is located at
Android Configuration:
- Set the unique application ID (package name) to
com.connectsphere.app. - Set the initial version code to
1. - Request permissions to use the device's
CAMERAand toREAD_EXTERNAL_STORAGE.
- Set the unique application ID (package name) to
iOS Configuration:
- Set the unique bundle identifier to
com.connectsphere.app. - Set the initial build number to
1. - Provide a user-facing reason for accessing the Photo Library. Use the key
NSPhotoLibraryUsageDescriptionand provide a descriptive string explaining that this allows users to select photos for their posts.
- Set the unique bundle identifier to
Expected result
Your app.json file should be a valid JSON object that correctly configures the 'ConnectSphere' app for its first production deployment. The completed configuration should meet all the requirements specified in the challenge.
Verification Checklist:
name: Set to"ConnectSphere".slug: Set to"connectsphere".version: Set to"1.0.0".icon: Path is set to"./assets/icon.png".splashobject:image: Set to"./assets/splash.png".resizeMode: Set to"contain".backgroundColor: Set to"#FFFFFF".
android.package: Set to"com.connectsphere.app".android.versionCode: Set to the number1.android.permissions: An array containing the strings"CAMERA"and"READ_EXTERNAL_STORAGE".ios.bundleIdentifier: Set to"com.connectsphere.app".ios.buildNumber: Set to the string"1".ios.infoPlist: An object containing the key"NSPhotoLibraryUsageDescription"with a descriptive, non-empty string value (e.g.,"ConnectSphere needs access to your photo library so you can share photos in your posts.").