Resurrecting an Ancient Flutter Project Without Touching the Code

Siro DavesSiro Daves
5 min read

So, my friend, you just got hired—congratulations! 🎉 You're introduced to the team, handed a laptop, given some access credentials, and then it hits you: your first task is to fix an old Flutter project that hasn’t been touched in years.

You open the repo, clone it, and—build fails. Curious, you check the Git logs—the last meaningful commit was made about three years ago. Flutter has changed a lot since then. You’re staring at a massive codebase that still uses pre-null safety syntax, probably hardcoded dependencies, and maybe even deprecated widgets.

It’s a mammoth project. Starting from scratch isn’t an option—it’s too big, too risky, and there’s pressure to deliver fast. And of course, you did say in your interview that you're "very experienced with Flutter," right? So now your boss is expecting magic.

But before you can even think about adding new features, you’ve got one job:

Make. It. Run.

This guide walks you through exactly how to do that—without touching the code.


Step 1: Getting the Right Flutter Version

The first and most critical step is ensuring you're using the same Flutter version the project was built with. A lot changes in 3+ years—Dart syntax, APIs, dependency constraints—and the older the code, the more likely it is to break on a modern Flutter SDK.

You have two main options for setting up the correct Flutter version:

FVM allows you to install multiple Flutter versions and switch between them per project, without interfering with your global setup.

🔧 Installing FVM:

dart pub global activate fvm

Or, if you're on macOS with Homebrew:

brew tap leoafarias/fvm  
brew install fvm

🔍 Identify the Required Flutter Version:

  • Check .metadata in the project root (look for version: 2.0.6).

  • If .metadata is missing, check pubspec.lock or the oldest Git commits.

📥 Install & Use the Correct Version:

fvm install 2.0.6  # Replace with your version  
fvm use 2.0.6

🚀 Run the Project:

fvm flutter pub get  
fvm flutter run

⚙️ IDE Setup (VS Code/Android Studio):

  • VS Code: Install the FVM extension and select the correct version.

  • Android Studio: Configure the Flutter SDK path to point to fvm’s cached version.

Option 2: Manually Install and Use a Separate Flutter Version (No FVM)

If you prefer not to use FVM, you can manually download and switch versions.

  1. Download the desired Flutter version from Flutter SDK releases.

  2. Extract it to a safe location (e.g., ~/flutter_versions/flutter_2_0_6/).

  3. Update your PATH:

    Temporarily (for current session):

     export PATH=~/flutter_versions/flutter_2_0_6/bin:$PATH
    

    Permanently (add to ~/.zshrc or ~/.bashrc):

     echo 'export PATH=~/flutter_versions/flutter_2_0_6/bin:$PATH' >> ~/.zshrc  
     source ~/.zshrc
    
  4. Verify the version:

     flutter --version
    
  5. Run the project:

     flutter pub get  
     flutter run
    

Step 2: Taming the Gradle Beast

If the project is 3–4 years old, the Android build system (Gradle) is likely ancient and will fight you. Here’s how to make it cooperate—without modifying the code.

1. Check the Existing Gradle Setup

Navigate to android/ and inspect:

  • gradle-wrapper.properties → Tells you the Gradle version.

      distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
    
  • build.gradle (Project-level) → Tells you the Android Gradle Plugin (AGP) version.

      classpath 'com.android.tools.build:gradle:4.1.0'
    

This means:

  • Gradle 6.7

  • AGP 4.1.0

2. Let Gradle Use Its Own Version (Best for Isolation)

Run from the android/ directory:

./gradlew wrapper --gradle-version 6.7  
./gradlew build

This ensures the project uses its original Gradle version, even if your system has a newer one.

3. Common Errors & Fixes

🚨 Kotlin Version Incompatibility

Error:

Kotlin version '1.3.50' is incompatible with the Kotlin Gradle plugin.

Fix:

  • Check android/build.gradle for the Kotlin version.

  • Install the correct version (don’t upgrade yet).

🚨 JDK Version Issues

Gradle 6.x + AGP 4.x usually require JDK 8 or 11. If you're on JDK 17+, downgrade temporarily:

export JAVA_HOME=$(/usr/libexec/java_home -v 11)  # macOS  
# OR  
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64  # Linux

🚨 AndroidX Migration Issues

If the project is pre-AndroidX, run it on an emulator/device with API ≤ 28 (Android 9 or older).

Pro Tip: Avoid flutter build Initially

Start with:

flutter clean  
flutter pub get  
flutter run

Avoid flutter build apk or flutter build appbundle—they trigger stricter checks.


Step 3: Let Android Studio Do the Heavy Lifting

Even if you prefer VS Code, opening the project in Android Studio helps resolve Gradle/JDK issues automatically.

Why Android Studio?

✅ Detects & installs missing JDK versions.
✅ Helps with Android SDK components (e.g., legacy build tools).
✅ Resolves Gradle plugin compatibility issues.

What to Do in Android Studio

  1. Open the android/ folder as a standalone project.

  2. Let it sync—it may prompt you to install the correct JDK.

  3. Fix JDK path (if needed):

    • Go to Preferences > Build, Execution, Deployment > Build Tools > Gradle.

    • Under Gradle JDK, select JDK 8 or 11.

  4. Sync again—Gradle should now work.


Step 4: Handling iOS (If Applicable)

If the project includes iOS, you might face:

1. CocoaPods Version Issues

Older Flutter projects may need CocoaPods ≤ 1.10.

sudo gem install cocoapods -v 1.10.0

2. Xcode Compatibility

  • Use Xcode 12-13 for older projects.

  • Open ios/Runner.xcworkspace (not .xcodeproj).

  • Set the iOS Deployment Target to match Podfile.


Final Checklist

Flutter version matches .metadata.
Gradle & AGP versions are correct.
JDK is set to 8/11 (not 17+).
Android Studio syncs without errors.
CocoaPods version is compatible.


What If It Still Doesn’t Work?

If you’ve followed all steps and still hit errors:

  1. Check pubspec.lock for exact dependency versions.

  2. Run in verbose mode for detailed logs:

     flutter run -v
    
  3. Ask the team if they have an old setup guide.


Conclusion

You didn’t write this code, but you can make it run. By locking the Flutter version, taming Gradle, and letting Android Studio help, you’ll resurrect the project without rewriting it.

Now go ahead—make that ancient Flutter app breathe again. 🚀

(And then, maybe, slowly start upgrading it…)

0
Subscribe to my newsletter

Read articles from Siro Daves directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Siro Daves
Siro Daves

Software engineer and a Technical Writer, Best at Flutter mobile app development, full stack development with Mern. Other areas are like Android, Kotlin, .Net and Qt