flutterfix 1.0.0
flutterfix: ^1.0.0 copied to clipboard
A zero-config CLI tool that automatically fixes Flutter & Android build errors — resolving Gradle, Kotlin, Java, and Flutter version mismatches with one command.
🔧 FlutterFix #
Make any Flutter project run instantly.
Automatically fixes Flutter, Gradle, Kotlin, and Java version conflicts with a single command.
🚀 Why FlutterFix? #
Ever cloned a Flutter project and spent hours debugging build errors?
❌ The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
❌ Unsupported class file major version 61
❌ java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy
FlutterFix solves this in seconds.
It automatically:
- ✅ Detects incompatible Flutter/Gradle/Kotlin/Java versions
- ✅ Updates configuration files with correct versions
- ✅ Fixes Android SDK mismatches
- ✅ Cleans build caches
- ✅ Makes any project buildable instantly
📦 Installation #
Option 1: Global Installation (Recommended) #
dart pub global activate flutterfix
Option 2: Local Installation #
dart pub global activate --source path .
Verify Installation #
flutterfix --version
🎯 Quick Start #
Basic Usage #
Navigate to your Flutter project and run:
flutterfix
That's it! The tool will:
- 🔍 Analyze your project
- 🔧 Fix version conflicts
- 🧹 Clean build caches
- ✅ Make your project ready to run
Install Compatible Flutter Version #
Auto-install based on project requirements:
flutterfix install
This will:
- 🔍 Detect your project's Flutter version requirement
- 📦 Install FVM (Flutter Version Management) if needed
- ⬇️ Download and install the compatible Flutter version
- 🔧 Configure your project to use the installed version
List all available Flutter versions:
flutterfix install --list
Install a specific Flutter version:
flutterfix install --version 3.24
Show version compatibility information:
flutterfix install --version 3.24 --info
Common Use Cases #
Fix a specific project:
flutterfix sync --path /path/to/flutter/project
Install compatible Flutter version:
flutterfix install
List available Flutter versions:
flutterfix install --list
Install specific Flutter version:
flutterfix install --version 3.24
Diagnose without fixing:
flutterfix doctor
Rollback changes (restore from backup):
flutterfix rollback
List all backups:
flutterfix rollback --list
Restore latest backup:
flutterfix rollback --latest
Upgrade FlutterFix:
flutterfix upgrade
Get help:
flutterfix --help
Rollback & Backup System #
FlutterFix automatically creates backups before modifying any files. You can easily restore previous versions:
Undo last changes (interactive):
flutterfix rollback
List all backups:
flutterfix rollback --list
Restore most recent backup:
flutterfix rollback --latest
Restore specific backup by ID:
flutterfix rollback --id <backup-id>
Clear all backups:
flutterfix rollback --clear
Backups are stored in .flutterfix/backups/ directory within your project. Each backup includes:
- Original file path
- Timestamp
- Description of changes
- Unique backup ID
✨ Features #
| Feature | Description |
|---|---|
| 🎯 Smart Version Detection | Automatically detects Flutter, Gradle, Kotlin, and Java versions |
| � Flutter Auto-Install | Installs compatible Flutter version using FVM or standalone |
| �🔄 Compatibility Matrix | Uses tested compatibility mappings for seamless fixes |
| 📝 Auto-Configuration | Updates build.gradle, gradle-wrapper.properties, and SDK settings |
| 🔙 Automatic Backups | Creates backups before making changes - rollback anytime |
| 🧹 Cache Cleaning | Removes stale build artifacts that cause issues |
| 📊 Detailed Reports | Shows what was fixed and what needs attention |
| 💡 Zero Config | Works out of the box with sensible defaults |
🛠️ What It Fixes #
1. Gradle Version Issues #
- Updates Gradle wrapper to compatible version
- Fixes Android Gradle Plugin (AGP) version
- Optimizes Gradle settings for performance
2. Kotlin Version Conflicts #
- Sets correct Kotlin version based on Flutter version
- Ensures Kotlin plugin is properly configured
- Fixes
ext.kotlin_versiondeclarations
3. Java Compatibility #
- Updates compile options (source/target compatibility)
- Checks Java version compatibility with Gradle
- Configures
kotlinOptions.jvmTarget
4. Android SDK Configuration #
- Updates
minSdkVersionto modern standards (21+) - Sets appropriate
compileSdkandtargetSdk - Ensures AndroidX compatibility
5. Build Cache Issues #
- Cleans Flutter build directory
- Removes Android build artifacts
- Clears Gradle cache
6. Flutter Version Management #
- Auto-installs compatible Flutter version
- Uses FVM (Flutter Version Management) for easy switching
- Supports standalone installations
- Lists available Flutter versions
7. Backup & Rollback System #
- Automatic backups before any file modifications
- Restore files to previous state with one command
- List all available backups with timestamps
- Clear old backups to save space
- Backup metadata includes descriptions and timestamps
📋 Example Output #
╔═══════════════════════════════════════════╗
║ 🔧 FlutterFix v1.0.0 🔧 ║
║ Auto-fix Flutter Build Errors ║
╚═══════════════════════════════════════════╝
🔍 Detecting installed versions...
Flutter: 3.24.0
Dart: 3.5.0
Java: 17
Gradle: 7.5
Kotlin: 1.7.10
🔎 Analyzing project structure...
✓ Valid Flutter project
Project: my_app
SDK: >=3.0.0 <4.0.0
✓ Android configuration found
🔧 Fixing Gradle configuration...
✓ Gradle version updated to 8.3
✓ Android Gradle Plugin updated to 8.1.0
✓ Gradle settings optimized
🔧 Fixing Kotlin configuration...
✓ Kotlin version updated to 1.9.0
✓ Kotlin plugin configured
🔧 Fixing Java & SDK configuration...
✓ Java 17 is compatible with Gradle 8.3
✓ Java compile options fixed
✓ Android SDK versions updated
═══════════════════════════════════════════
📊 Summary
═══════════════════════════════════════════
✅ Fixed (7):
• Gradle configuration
• Kotlin configuration
• Java & SDK configuration
• Build cache cleaned
• Dependencies fetched
✅ Project fixed successfully!
You can now run: flutter run
🧪 Compatibility Matrix #
| Flutter | Gradle | AGP | Kotlin | Java | Min SDK | Compile/Target SDK |
|---|---|---|---|---|---|---|
| 3.38.x | 8.9 | 8.7.0 | 2.0.20 | 17+ | 21 | 35 |
| 3.35.x | 8.8 | 8.6.0 | 2.0.10 | 17+ | 21 | 35 |
| 3.32.x | 8.7 | 8.5.0 | 2.0.0 | 17+ | 21 | 35 |
| 3.29.x | 8.6 | 8.4.0 | 1.9.24 | 17+ | 21 | 34 |
| 3.27.x | 8.5 | 8.3.0 | 1.9.22 | 17+ | 21 | 34 |
| 3.24.x | 8.3 | 8.1.0 | 1.9.0 | 17+ | 21 | 34 |
| 3.22.x | 8.0 | 8.0.0 | 1.8.22 | 17+ | 21 | 34 |
| 3.19.x | 7.6 | 7.4.0 | 1.8.0 | 17+ | 21 | 33 |
| 3.16.x | 7.5 | 7.3.0 | 1.7.10 | 11+ | 21 | 33 |
| 3.13.x | 7.4 | 7.2.0 | 1.7.0 | 11+ | 21 | 33 |
| 3.10.x | 7.3 | 7.1.0 | 1.6.10 | 11+ | 21 | 32 |
| 3.7.x | 7.2 | 7.0.0 | 1.6.0 | 11+ | 21 | 31 |
| 3.3.x | 6.7 | 4.1.0 | 1.5.31 | 11+ | 21 | 30 |
🚀 CI/CD Integration #
FlutterFix can be integrated into your CI/CD pipeline to automatically fix version conflicts.
GitHub Actions #
Add FlutterFix to your GitHub Actions workflow:
name: Flutter CI
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Install FlutterFix
run: dart pub global activate flutterfix
- name: Fix version conflicts
run: flutterfix sync
- name: Run tests
run: flutter test
For more examples, see examples/ci-cd/ directory.
Benefits in CI/CD #
- ✅ Automatic version fixing - No manual intervention needed
- ✅ Consistent builds - Same configuration across all environments
- ✅ Catch issues early - Detect conflicts before merging
- ✅ Zero configuration - Works out of the box
- ✅ Fast execution - Completes in seconds
🤝 Contributing #
Contributions are welcome! Here's how you can help:
- 🍴 Fork the repository
- 🔨 Create a feature branch (
git checkout -b feature/amazing-feature) - 💾 Commit your changes (
git commit -m 'Add amazing feature') - 📤 Push to the branch (
git push origin feature/amazing-feature) - 🎉 Open a Pull Request
Development Setup #
# Clone the repo
git clone https://github.com/haraprosad/flutterfix.git
cd flutterfix
# Install dependencies
dart pub get
# Run tests
dart test
# Activate locally
dart pub global activate --source path .
📄 License #
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments #
- Built with ❤️ for the Flutter community
- Inspired by countless hours debugging version conflicts
- Thanks to all contributors and users
📞 Support #
- 📧 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 🐦 Twitter: @haraprosad
Made with 🔧 by developers, for developers