Troubleshooting Martfury Flutter App
This guide will help you resolve common issues that may arise when using the Martfury Flutter mobile application.
Installation and Setup Issues
Flutter Dependencies Issues
If you encounter problems with Flutter dependencies:
Clean and Reinstall Dependencies:
bashflutter clean flutter pub get
Check Flutter Version:
bashflutter --version flutter doctor
Ensure you're using Flutter 3.7.2 or higher.
Update Dependencies:
bashflutter pub upgrade
Environment Configuration Problems
If the app can't load environment variables:
Check .env File:
- Ensure
.env
file exists in the root directory - Verify the file is not named
.env.txt
- Check that all required variables are set
- Ensure
Environment Variables Format:
bashAPI_BASE_URL=https://your-api-url.com APP_NAME=Martfury APP_ENV=development
Restart the App:
- Stop the app completely
- Run
flutter clean
- Restart with
flutter run
Build Errors
Android Build Issues
Gradle Build Errors:
bashcd android ./gradlew clean cd .. flutter clean flutter pub get
SDK Version Issues:
- Check
android/app/build.gradle
- Ensure
compileSdkVersion
andtargetSdkVersion
are compatible - Update Android SDK if needed
- Check
Memory Issues:
- Increase Gradle memory in
android/gradle.properties
:
propertiesorg.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m
- Increase Gradle memory in
iOS Build Issues
Pod Installation Issues:
bashcd ios rm -rf Pods rm Podfile.lock pod install cd .. flutter clean flutter pub get
Xcode Version:
- Ensure you're using Xcode 12.0 or higher
- Update Xcode if necessary
Signing Issues:
- Open
ios/Runner.xcworkspace
in Xcode - Configure signing with your Apple Developer Account
- Open
API Connection Issues
Backend Connection Problems
If the app can't connect to your backend:
Check API URL:
- Verify
API_BASE_URL
in.env
file is correct - Ensure the URL is accessible from your device
- Test the URL in a web browser
- Verify
Network Connectivity:
- Check internet connection on your device
- Try switching between WiFi and mobile data
- Test with different networks
CORS Configuration:
- Ensure CORS is properly configured on your backend
- Check that mobile app requests are allowed
- Verify allowed headers and methods
Authentication Issues
If login/authentication fails:
Check Credentials:
- Verify email and password are correct
- Check if account exists in the backend
- Try password reset if needed
API Endpoints:
- Ensure authentication endpoints are working
- Test login API with Postman or similar tool
- Check API response format
Token Issues:
- Clear app data and try again
- Check token storage and retrieval
- Verify token expiration handling
Social Login Issues
If social login fails:
Google Sign-In Problems
Configuration Issues:
- Verify
google-services.json
is correctly placed - Check SHA-1 fingerprint is added to Firebase Console
- Ensure Google Sign-In is enabled in Firebase Authentication
- Verify
Android-Specific Issues:
bash# Get debug SHA-1 fingerprint keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
- Add the SHA-1 fingerprint to Firebase Console
- Verify package name matches in Firebase
iOS-Specific Issues:
- Check
REVERSED_CLIENT_ID
is correctly added to URL schemes - Verify
GoogleService-Info.plist
is added to Xcode project - Ensure iOS bundle ID matches Firebase configuration
- Check
Facebook Login Problems
App Configuration:
- Verify Facebook App ID and Client Token are correct
- Check app is in "Live" mode (not Development)
- Ensure package name and key hashes are configured
Android Issues:
- Generate and add key hash to Facebook App Console:
bashkeytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
- Verify
strings.xml
contains correct Facebook App ID
iOS Issues:
- Check Facebook App ID is correctly added to
Info.plist
- Verify URL scheme
fbYOUR_FACEBOOK_APP_ID
is configured - Ensure app is added to Facebook App Console
- Check Facebook App ID is correctly added to
Apple Sign-In Problems
iOS Configuration:
- Verify "Sign In with Apple" capability is enabled in Xcode
- Check
Runner.entitlements
contains Apple Sign-In capability - Ensure Apple Developer Account has Sign In with Apple enabled
Common Issues:
- Apple Sign-In only works on iOS 13+ and macOS 10.15+
- Ensure app is signed with valid provisioning profile
- Check Apple Developer Console for Sign In with Apple configuration
General Social Login Issues
Network Issues:
- Check internet connectivity
- Verify social provider APIs are accessible
- Test with different networks
Backend Integration:
- Ensure backend supports social login endpoints
- Verify social login API responses match expected format
- Check backend logs for social authentication errors
User Account Issues:
- Check if social account email already exists with different provider
- Verify account linking logic in backend
- Test account creation flow for new social users
Data Loading Problems
If products or other data won't load:
API Response:
- Check if backend APIs are returning data
- Verify API response format matches app expectations
- Look for error messages in API responses
Network Timeout:
- Increase API timeout in configuration
- Check for slow network connections
- Verify backend server performance
Data Format Issues:
- Ensure API returns data in expected JSON format
- Check for missing required fields
- Verify data types match app models
App Performance Issues
Slow Loading
If the app loads slowly:
Image Optimization:
- Optimize product images on the backend
- Enable image caching in the app
- Use appropriate image formats (WebP, JPEG)
Network Optimization:
- Implement pagination for large data sets
- Use lazy loading for images
- Cache frequently accessed data
Memory Management:
- Monitor memory usage
- Dispose of unused resources
- Optimize widget rebuilds
App Crashes
If the app crashes frequently:
Check Logs:
bashflutter logs
Look for error messages and stack traces
Memory Issues:
- Monitor memory usage
- Check for memory leaks
- Optimize image loading
Device Compatibility:
- Test on different devices
- Check minimum OS version requirements
- Verify hardware compatibility
Payment Issues
Payment Gateway Problems
If payments fail:
Gateway Configuration:
- Verify payment gateway settings in backend
- Check API keys and credentials
- Ensure gateway supports your region
Test Mode:
- Test payments in sandbox mode first
- Use test card numbers provided by gateway
- Verify test transactions work correctly
Network Issues:
- Check internet connectivity during payment
- Verify payment gateway URLs are accessible
- Test with different networks
Order Processing Issues
If orders aren't processed correctly:
Order API:
- Check order creation API endpoint
- Verify order data format
- Test order submission manually
Payment Confirmation:
- Ensure payment confirmation is received
- Check webhook configuration
- Verify order status updates
UI/UX Issues
Layout Problems
If the UI doesn't display correctly:
Screen Compatibility:
- Test on different screen sizes
- Check responsive design implementation
- Verify widget constraints
Theme Issues:
- Check theme configuration
- Verify color and style definitions
- Test dark mode compatibility
Localization Problems:
- Verify translation files exist
- Check for missing translation keys
- Test language switching
Navigation Issues
If navigation doesn't work properly:
Route Configuration:
- Check route definitions
- Verify navigation logic
- Test deep linking
State Management:
- Check GetX controller initialization
- Verify state updates
- Test navigation between screens
Push Notification Issues
Notifications Not Working
If push notifications aren't received, follow these comprehensive troubleshooting steps:
Firebase Configuration Issues
Configuration Files:
- Verify
google-services.json
is inandroid/app/
directory - Check
GoogleService-Info.plist
is added to Xcode project - Ensure files match your Firebase project configuration
- Verify package names match Firebase app registration
- Verify
Firebase Project Setup:
- Check Firebase project has Cloud Messaging enabled
- Verify Server Key is available in project settings
- Ensure both Android and iOS apps are added to project
- Check SHA-1 fingerprint is added for Android
Dependencies:
bashflutter clean flutter pub get
- Verify Firebase dependencies are correctly added
- Check for version conflicts in pubspec.yaml
Platform-Specific Issues
Android Issues:
Build Configuration:
- Check
google-services
plugin is applied - Verify Gradle dependencies are correct
- Ensure minimum SDK version is 21 or higher
- Check
Permissions and Manifest:
- Check required permissions in AndroidManifest.xml
- Verify FCM service is declared
- Check notification channel configuration
Device Settings:
- Disable battery optimization for the app
- Check notification settings are enabled
- Verify app has notification permissions
iOS Issues:
Xcode Configuration:
- Enable "Push Notifications" capability
- Enable "Background Modes" > "Remote notifications"
- Check provisioning profile includes push notifications
APNS Certificate:
- Verify APNS certificate is uploaded to Firebase
- Check certificate is not expired
- Ensure certificate matches app bundle ID
Device Requirements:
- Test on physical device (not simulator)
- Check iOS version compatibility (iOS 10+)
- Verify device has internet connection
Token and Registration Issues
Token Generation:
dart// Check token in logs String? token = await FirebaseMessaging.instance.getToken(); print('FCM Token: $token');
Token Refresh:
- Implement token refresh listener
- Update token on server when refreshed
- Handle token changes properly
Permission Handling:
dart// Check notification permissions NotificationSettings settings = await FirebaseMessaging.instance.requestPermission(); print('Permission status: ${settings.authorizationStatus}');
Backend Integration Issues
Server Key:
- Verify correct server key is used
- Check server key has necessary permissions
- Test with Firebase Console first
API Endpoints:
- Verify FCM API endpoints are working
- Check request format and headers
- Test with Postman or similar tool
Message Format:
json{ "to": "FCM_TOKEN", "notification": { "title": "Test", "body": "Test message" }, "data": { "type": "test" } }
Testing and Debugging
Firebase Console Testing:
- Use Firebase Console to send test messages
- Test with specific device tokens
- Try different message types
Debug Logs:
bash# Android adb logcat | grep FCM # iOS xcrun devicectl device logs --device [device-id] | grep FCM
Network Testing:
- Check internet connectivity
- Test with different networks
- Verify firewall settings
For complete FCM setup instructions, see the FCM Setup Guide.
Advanced Troubleshooting
Debug Mode
Enable debug mode for detailed logging:
Flutter Debug:
bashflutter run --debug
Enable Logging:
- Set
ENABLE_LOGGING=true
in.env
- Check console output for errors
- Use debug prints strategically
- Set
Performance Profiling
Profile app performance:
Flutter Inspector:
- Use Flutter Inspector in IDE
- Monitor widget tree
- Check for performance bottlenecks
Memory Profiling:
bashflutter run --profile
Use DevTools for memory analysis
Network Debugging
Debug network issues:
Network Inspector:
- Use network debugging tools
- Monitor API requests and responses
- Check for failed requests
Proxy Tools:
- Use Charles Proxy or similar tools
- Monitor HTTPS traffic
- Debug API communication
Device-Specific Issues
Android Issues
Permissions:
- Check app permissions in device settings
- Verify required permissions are declared
- Test permission request flow
Storage Issues:
- Check available storage space
- Clear app cache if needed
- Verify file access permissions
iOS Issues
Simulator vs Device:
- Test on both simulator and physical device
- Check for simulator-specific issues
- Verify device compatibility
App Store Guidelines:
- Ensure compliance with App Store guidelines
- Check for rejected features
- Verify privacy policy requirements
Getting Support
If you're unable to resolve the issue using this troubleshooting guide:
Documentation Resources
- API Documentation: https://ecommerce-api.botble.com/docs
- Flutter Documentation: https://flutter.dev/docs
- Botble Documentation: https://docs.botble.com
Support Channels
- Support Center: https://botble.ticksy.com
- Community Forum: https://botble.com/forum
- GitHub Issues: Report bugs and feature requests
When Contacting Support
Please provide the following information:
- Detailed Description: Clear description of the issue
- Steps to Reproduce: Exact steps to reproduce the problem
- Environment Information:
- Flutter version (
flutter --version
) - Device information (OS version, model)
- App version
- Backend version
- Flutter version (
- Error Messages: Complete error messages and stack traces
- Screenshots/Videos: Visual evidence of the issue
- Configuration: Relevant configuration settings (without sensitive data)
Log Collection
Collect relevant logs:
Flutter Logs:
bashflutter logs > app_logs.txt
Device Logs:
- Android: Use
adb logcat
- iOS: Use Xcode Console
- Android: Use
Backend Logs: Check your Botble backend logs for API errors
Testing Checklist
Before reporting issues, verify:
- [ ] Issue occurs on multiple devices
- [ ] Latest app version is installed
- [ ] Backend is accessible and working
- [ ] Network connectivity is stable
- [ ] All dependencies are up to date
- [ ] Configuration is correct
- [ ] Issue is reproducible consistently