Troubleshooting & Maintenance
This section covers common compilation errors, SDK conflicts, and build optimization scripts. Use these steps to resolve issues when compiling or building the GreenCart mobile application.
1. Standard Cleanup Commands
If you face unexpected compiler errors after updating package dependencies or pulling codebase updates, the local build caches may be out of sync. Use the cleanup process below to reset the build environment:
- Clean the build caches:
flutter clean
- Refresh package dependencies:
flutter pub get
- (For iOS development only) Re-install native iOS pods:
cd iospod deintegratepod cache clean --allpod install --repo-updatecd ..
2. Common Android Build Errors
Missing SDK Licenses
- Symptom: "Android SDK file not found" or "Licenses not accepted" during
flutter build apk. - Fix: Accept Android SDK licenses via command-line:
Typeflutter doctor --android-licenses
y(yes) to accept all agreements.
Multidex Limit Reached
- Symptom:
The number of method references in a .dex file cannot exceed 64K. - Fix: Android Multidex is already configured in GreenCart, but if you customize settings or add heavy packages, open
android/app/build.gradleand ensure:android {defaultConfig {multiDexEnabled true}}
3. Common iOS Compilation Issues
CocoaPods Mismatch on M1/M2/M3 Apple Silicon Macs
- Symptom: Build fails during the
pod installstep with architecture mismatch warnings. - Fix: Force the CocoaPods engine to run using x86 translation compatibility mode:
sudo arch -x86_64 gem install cocoapodsarch -x86_64 pod install --repo-update
CocoaPods Out of Date
- Symptom: Dependency compilation fails due to outdated pod specs.
- Fix: Run a pod specs update inside the iOS folder:
cd iospod repo updatepod installcd ..
Signing and Profile Configuration
- Symptom:
Signing for "Runner" requires a development team. - Fix:
- Open
ios/Runner.xcworkspacein Xcode. - Select the Runner project, choose the Signing & Capabilities tab.
- Under Signing, choose your registered Development Team in the dropdown.
- Ensure Automatically manage signing is checked.
- Open
4. Release Optimization Guide
When compiling the final production bundles for Google Play Store and Apple App Store, use the commands below to compile with full compilation optimizations:
Build Android App Bundle (AAB):
flutter build appbundle --release
The resulting .aab file will be located at build/app/outputs/bundle/release/app-release.aab.
Build iOS Archive (IPA):
flutter build ipa --release
Upload the compiled archive to App Store Connect using Xcode Transporter or directly from Xcode Organizer.