请求ExpoKit应用iOS及Android分发打包分步指南
Hey there! I totally get where you're coming from—ExpoKit has some subtle but important differences from standard Expo apps when it comes to packaging, and it's easy to feel stuck when the docs don't spell it out clearly. Let's walk through the step-by-step process for both iOS and Android to get your app ready for distribution.
Since you already have a running ExpoKit app, you should have an ios directory in your project root. Here's what to do next:
Prep your environment & dependencies
- First, make sure you're on the latest Expo CLI:
npm install -g expo-clioryarn global add expo-cli - Navigate to your project root and run
expo installto sync all dependencies with your ExpoKit version—this avoids weird compatibility bugs later.
- First, make sure you're on the latest Expo CLI:
Configure signing credentials in Xcode
- Open your project in Xcode using the
ios/[YourProjectName].xcworkspacefile (not the.xcodeproj—this is crucial for CocoaPods dependencies). - Go to the Signing & Capabilities tab for your main target.
- Log in with your Apple Developer account if you haven't already, then select your team. Xcode will automatically create or fetch the necessary distribution certificate and provisioning profile (make sure you pick the right type: App Store, Ad Hoc, or Enterprise depending on your distribution needs).
- Open your project in Xcode using the
Build the archive
- In the Xcode toolbar, set the target device to Any iOS Device (arm64).
- Go to Product > Archive in the top menu.
- Wait for Xcode to finish building—this might take a few minutes depending on your project size. Once done, the Organizer window will pop up with your new archive.
Export the IPA for distribution
- In the Organizer, select your archive and click Distribute App.
- Choose your distribution method:
- App Store Connect: For submitting to the App Store
- Ad Hoc: For testing with a limited group of users
- Enterprise: For internal company distribution
- Follow the on-screen wizard to confirm settings, select export options, and save the IPA file to your local machine.
ExpoKit Android projects use Gradle, so the process is similar to standard native Android apps but with a few Expo-specific checks.
Prep your environment
- Ensure Android Studio is installed and the
ANDROID_HOMEenvironment variable is set correctly on your system. - Update Expo CLI:
npm install -g expo-cli - Run
expo installin your project root to sync dependencies.
- Ensure Android Studio is installed and the
Generate a signing keystore (if you don't have one)
- Open a terminal and run this command to create a keystore file (replace placeholders with your own details):
keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000 - Move the generated
my-release-key.keystorefile to theandroid/appdirectory of your project.
- Open a terminal and run this command to create a keystore file (replace placeholders with your own details):
Configure Gradle for signing
- Open
android/gradle.propertiesand add these lines (fill in your keystore details):MYAPP_RELEASE_STORE_FILE=my-release-key.keystore MYAPP_RELEASE_KEY_ALIAS=my-key-alias MYAPP_RELEASE_STORE_PASSWORD=your_keystore_password MYAPP_RELEASE_KEY_PASSWORD=your_key_alias_password - Open
android/app/build.gradleand update thebuildTypesblock to include signing configs:android { // ... other configurations 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 { // ... existing release configs signingConfig signingConfigs.release } } }
- Open
Build the APK or AAB
- For APK (direct distribution): Run this command from your project root:
The APK will be atcd android && ./gradlew assembleReleaseandroid/app/build/outputs/apk/release/app-release.apk - For AAB (recommended for Google Play): Run:
The AAB will be atcd android && ./gradlew bundleReleaseandroid/app/build/outputs/bundle/release/app-release.aab
- For APK (direct distribution): Run this command from your project root:
- Always run
expo updatebefore packaging to make sure ExpoKit and your Expo SDK version are in sync—mismatches cause most build errors. - For iOS, double-check that any third-party native modules you're using are properly linked in Xcode (ExpoKit handles most, but some might need manual setup).
- For Android, if you hit dependency conflicts, run
./gradlew dependenciesfrom theandroiddirectory to inspect the dependency tree and adjust versions as needed.
内容的提问来源于stack exchange,提问作者Sebastian Garrido

