Build Optimization Guide
Overview
This document provides instructions for building optimized release versions of the AI-Powered Photo Journaling app with maximum performance and minimal bundle size.Release Build Commands
iOS Release Build (Optimized)
IPA Build for App Store
Build Flags Explained
Build Configuration Files
1. Environment Files
Create.env.production for production builds:
2. Export Options (iOS)
Createios/ExportOptions.plist:
Size Optimization Steps
1. Pre-Build Optimization
2. Asset Optimization
3. Dependency Audit
4. Code Analysis
Performance Profiling
1. Profile Mode Build
2. DevTools Profiling
3. Memory Profiling
Use theMemoryProfiler utility in debug mode:
Expected Bundle Sizes
Build Scripts
Automated Release Build
Createscripts/build_release.sh:
Size Analysis Script
Createscripts/analyze_size.sh:
App Thinning (iOS)
Apple automatically applies App Thinning for App Store distributions:- Slicing: Delivers only assets for specific device
- Bitcode: Allows Apple to recompile for new architectures
- On-Demand Resources: Downloads resources when needed
Build Verification Checklist
Before submitting to App Store:- All tests passing (
flutter test) - No analysis warnings (
flutter analyze) - Performance profiled in profile mode
- Memory leaks checked with MemoryProfiler
- Image cache optimized
- Bundle size < 30 MB (pre-thinning)
- App launches in < 2 seconds
- Timeline scrolls at 60 FPS
- No crashes in TestFlight
- All features working in release mode
- Analytics/error tracking configured
- Debug symbols uploaded
Continuous Integration
GitHub Actions Example
Troubleshooting
Build Too Large
- Check asset sizes:
find assets -type f -exec ls -lh {} \; - Remove unused dependencies
- Compress images
- Use deferred loading for optional features
Slow Build Times
- Use
--analyze-sizeto identify bottlenecks - Clean build folder:
flutter clean - Update Flutter:
flutter upgrade - Use
--no-tree-shake-iconsduring development
Obfuscation Issues
- Check stack traces with mapping file
- Disable obfuscation for debugging: remove
--obfuscate - Keep symbols for crash reporting
Resources
Last Updated: 2025-11-15 Maintained By: Frontend Developer / DevOps Engineer