When creating apk/ipa, if there is changes in ReactNative, you need first to run npm run bundle-android
or npm run bundle-ios
.
-
android
- clean: Android Studio -> Build -> Clean Project
- bundle: run command under vscode
npm run bundle-android
- Delete dumplicated resources: app➜res下的drawable、raw
- Change appName(if needed): res➜values➜string.xml
- Change applicationId(if needed): app-->build.gradle➜defaultConfig➜applicationId
- Change versionCode(if needed): for android playstore to see if new version uploaded
- Change versionName: for android playstore,version shoule be same with page
- Start creating Apk: Click: build➜ Generate Signed Bundle or APK➜APK➜NEXT➜Choose Key Store
- Export: Click
locate
to release folder,file app-release.apk is the last file(/android/app/release/)
If errors, clean cache. Follow there steps below
- Delete android/app/build and android/build
-
ios
- Go to ios folder
- XCode: Double-click [YOUR PROJECT NAME].xcworkspace
- Choose device: 在XCode中模拟器选择 [YOUR PROJECT NAME]>Any ios Device
- clean: Product -> Clean Build Folder
- bundle: Switch to vscode command line
npm run bundle-ios
- Change
Display Name
(if needed): TARGETS -> [YOUR PROJECT NAME] -> General - Config cert: TARGETS -> [YOUR PROJECT NAME] -> Signing & Capabilities -> Release -> Signing,Bundle Indentifier com.**
- Start creating ipa: Product➜Archive
- Export to App connect: Popup window Click Distribute App➜Applee Connect➜Next➜Next➜Select Profile➜Next➜Export
If error occurs clean cache. when creating, follow these steps:
- Delete the build folder: ios/build
- clear native cache in /Users/mohammedyasar/Library/Developer/Xcode/DerivedData
-
ios:
- Clear xcode derive data in [File]-> [WorkSpace]-> Click the right arrow top of [Anvanced] Open [DerivedData]-> Remove the Questionaires.. folder.
- Remove node_modules. run
rf -rf node_modules
. - npx pod-install