react native 如何发布
发布 React Native 应用到应用商店
生成发布版本
Android 平台需要生成 APK 或 AAB(Android App Bundle),iOS 平台需要构建 IPA 文件。
Android 发布构建
进入项目根目录,运行以下命令生成签名 APK:
cd android && ./gradlew assembleRelease
或生成 AAB(推荐用于 Google Play 发布):
cd android && ./gradlew bundleRelease
iOS 发布构建
在 Xcode 中:

- 选择 Generic iOS Device 或连接真实设备。
- 菜单栏选择 Product > Archive。
- 在 Organizer 窗口中选择生成的归档文件,点击 Distribute App。
配置签名和密钥
Android 签名
在 android/app/build.gradle 中配置签名信息:
android {
signingConfigs {
release {
storeFile file('my-release-key.keystore')
storePassword 'yourpassword'
keyAlias 'yourkeyalias'
keyPassword 'yourkeypassword'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
iOS 签名
在 Xcode 中配置开发者账号和证书:
- 项目设置中选择 Signing & Capabilities。
- 选择正确的 Team 和 Provisioning Profile。
发布到应用商店
Google Play 发布

- 登录 Google Play Console。
- 创建应用或选择现有应用。
- 上传 AAB 或 APK 文件到 Release 部分。
Apple App Store 发布
- 登录 App Store Connect。
- 创建新应用或选择现有应用。
- 通过 Xcode 或 Transporter 上传 IPA 文件。
测试版本分发
Android 测试分发
使用 Firebase App Distribution 或直接分享 APK:
adb install app-release.apk
iOS 测试分发
通过 TestFlight 分发:
- 在 App Store Connect 中上传构建版本。
- 添加测试人员并提交审核。
更新应用
后续更新需重复构建和发布流程,确保版本号递增(Android versionCode,iOS CFBundleVersion)。






