Description
Description
I recently upgraded from RN v0.60.5 to RN v0.62.2 and I noticed that my iOS release builds are now producing an .ipa file nearly triple in size, from ~50MB to ~130MB, however the adhoc builds increased from ~25MB to ~29MB. No other changes have been made to my app besides the upgrade, which I followed the Upgrade Helper tool for the migration. I did have one build issue with Flipper, which I was able to solve by modifying my pod file's flipper post install following these instructions. I can't seem to find any reason why my iOS build would be producing such a large release ipa file. I'm guessing it has something to do with Flipper, but that is simply a guess. I do have several existing images and fonts that I can probably be removed from my app to decrease the overall size, but regardless, why would my builds produce such a huge increase in size? I can't seem to find any reason for this. By the way, the Android build produces an release apk size fairly similar to the pre upgrade size (~49MB to ~50MB). Also to note, this is not an Expo project, but a RN Cli project.
Additionally, here is my build script that produces both an adhoc and release build:
#/bin/bash
set -e
# Try to run from the project root
if (test "${PWD%%/scripts}" != "${PWD}"); then cd ..; echo ${PWD}; fi
IOS_APP_ID=com.voyaj.ios
WORKSPACE_NAME=voyaj
IOS_SCHEME=voyaj
IOS_CONFIGURATION=Release
DEVELOPMENT_TEAM=FHKD78FHJD
echo $IOS_APP_ID
echo $WORKSPACE_NAME
echo $IOS_SCHEME
echo $IOS_CONFIGURATION
echo $IOS_EXPORT_OPTIONS_PLIST
echo "======================================"
echo "Running Pod install..."
echo "--------------------------------------"
cd ios && pod install
if [[ $? -ne 0 ]]; then
echo
echo "Pod install FAILED!"
exit 1
fi
echo
echo "======================================"
echo "Archiving the iOS project..."
echo "--------------------------------------"
xcodebuild clean archive -workspace ./${WORKSPACE_NAME}.xcworkspace -scheme $IOS_SCHEME -configuration $IOS_CONFIGURATION -derivedDataPath ./build -archivePath ./build/Products/${WORKSPACE_NAME}.xcarchive
if [[ $? -ne 0 ]]; then
echo
echo "Failed to export Adhoc IPA"
exit 1
fi
echo
echo "======================================"
echo "Exporting Adhoc IPA..."
echo "--------------------------------------"
xcodebuild -exportArchive -exportOptionsPlist "./ExportOptions/Voyaj-${DEVELOPMENT_TEAM}-AdHoc.plist" -archivePath "./build/Products/${WORKSPACE_NAME}.xcarchive" -exportPath "./build/Products/IPA/AdHoc" DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}"
if [[ $? -ne 0 ]]; then
echo
echo "Failed to export Adhoc IPA"
exit 1
fi
echo
echo "======================================"
echo "Exporting Release IPA..."
echo "--------------------------------------"
xcodebuild -exportArchive -exportOptionsPlist "./ExportOptions/Voyaj-${DEVELOPMENT_TEAM}-AppStore.plist" -archivePath "./build/Products/${WORKSPACE_NAME}.xcarchive" -exportPath "./build/Products/IPA/Release" DEVELOPMENT_TEAM="${DEVELOPMENT_TEAM}"
if [[ $? -ne 0 ]]; then
echo
echo "Failed to export Release IPA"
exit 1
fi
echo "IPA package location: ./ios/build/Products/IPA"
React Native version:
System:
OS: macOS Mojave 10.14.6
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 45.24 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.12.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.7.5 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_212 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Upgrade existing project from 0.60.x to 0.62.2
- Modify Flipper post install block (via these instructions). My pod file's filpper post install block looks like this:
# Post Install processing for Flipper
def flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
cflags << '-DFB_SONARKIT_ENABLED=1'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
app_project.save
end
installer.pods_project.save
end
Expected Results
I expect the release build ipa file size to be similar to the file size prior to upgrading to RN v0.62.2 from RN v0.60.5