Publicado · en mejora
Guía de React Native · 6/6
Por ahora, este capítulo solo está disponible en inglés.
Getting a React Native app to users means producing a release build, signing it according to each platform's rules and submitting it to Google Play and the App Store. This chapter covers doing that with Expo's EAS, doing it with the native tools directly, and shipping over-the-air updates.
version separate from the number that increases with every build (iOS buildNumber, Android versionCode).{
"expo": {
"version": "1.2.0",
"ios": { "bundleIdentifier": "com.example.myapp", "buildNumber": "12" },
"android": { "package": "com.example.myapp", "versionCode": 12 }
}
}In a release build the JavaScript is bundled ahead of time into the app (as Hermes bytecode) and runs without a dev server. Always try the release build on a real device before submitting.
EAS Build is Expo's cloud build service, and it works with both Expo projects and plain React Native projects. You can build iOS apps without a Mac, and EAS can generate and store your signing keystore, certificates and provisioning profiles.
npm install -g eas-cli
eas login
eas build:configure
eas build --platform android --profile production
eas build --platform ios --profile productioneas build:configure creates eas.json, which holds your build profiles:
{
"cli": { "appVersionSource": "remote" },
"build": {
"development": { "developmentClient": true, "distribution": "internal" },
"preview": { "distribution": "internal" },
"production": { "autoIncrement": true }
},
"submit": { "production": {} }
}development produces development builds, preview is for internal testing and production is for store submission; autoIncrement bumps the build number for you. Inspect and manage credentials with eas credentials, and run eas build --local to build on your own machine.
eas submit --platform ios
eas submit --platform android
eas build --platform all --auto-submitiOS builds are uploaded to App Store Connect, where you can run a TestFlight beta before submitting for review. Android submissions need a Google service account key, and Google Play requires the very first upload to be done manually in the Play Console. Google Play expects an AAB (Android App Bundle), not an APK.
To ship a Community CLI project without EAS, use the platform tools directly. On Android, create an upload key and add a signing config to Gradle:
keytool -genkeypair -v -storetype PKCS12 -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000// android/app/build.gradle
android {
signingConfigs {
release {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}Keep the MYAPP_UPLOAD_... values in ~/.gradle/gradle.properties rather than the repository, and back up the keystore safely. Then run ./gradlew bundleRelease in the android folder to produce android/app/build/outputs/bundle/release/app-release.aab. With Play App Signing, Google manages the final app signing key.
On iOS, run Product > Archive in Xcode with the Release configuration and upload from the Organizer to App Store Connect. Signing requires a distribution certificate and provisioning profile from your Apple Developer account.
When only JavaScript and assets such as images change, you can push an update to installed apps without a store review. Expo provides this through expo-updates and EAS Update.
npx expo install expo-updates
eas update:configure
eas update --channel production --message "Fix login screen copy"Apps download the new update for their channel and apply it on a later launch. Changes to native code or native configuration still need a new store build, and an update is only delivered to builds with a matching runtimeVersion. Updates must also follow store policies, so changes to an app's primary purpose still go through review.
bundleRelease on Android, and an Xcode archive on iOS.Official documentation:
0 comentarios
Iniciar sesión · Inicia sesión para dejar un comentario.
Sé el primero en comentar.