OK, let's run this OLD Flutter project...

OK, let's run this OLD Flutter project...

Tarik Waleed's photo
Tarik Waleed
ยทJul 21, 2022ยท

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Table of contents

  • Fix #1
  • Fix #2
  • Fix #3
  • Fix #4
  • Fix #5

It's early in the morning, and you're so in the mood for exploring new things in flutter, so you decided to follow a youtube tutorial, a medium story, or even a chapter in your favorite text, you're following along and everything is awesome.

The app looks beautiful and it's so tempting to try it yourself on your machine, because .. why not?! So, you cloned the repo, hit the green little run button and you're waiting for the app to build, but sadly, it didn't!

Don't worry, this happened to me a million times before, and I managed to fix all of the issues I've encountered.

Fix #1

Run the usual pub commands

flutter pub get

flutter pub upgrade

flutter pub outdated

This is an obvious fix because if you didn't do it, the app will throw a gazillion errors at your face.

Fix #2

open android/build.gradle

spot this line

buildscript {
    ext.kotlin_version = '1.5.0'

change the kotlin version to the latest version or the one before it. The version number depends on the packages used in the project.

version 1.5.0 worked most of the time.

Fix #3

open android/app/build.gradle

spot this line

android {
    compileSdkVersion 26

change compileSdkVersion to something high like 29.

31 worked for most cases.

Fix #4

open android/app/scr/main/AndroidManifext.xml

spot this line

<application
        android:name="io.flutter.app.FlutterApplication"

and change it to

<application
        android:name="${applicationName}"

Fix #5

open android/gradle/wrapper/gradle-wrapper.properties

spot this line

distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

change the Gradle version to the version compatible with the kotlin version.

If you've changed the kotlin version to 1.5.0 as Fix #2 stated, gradle-6.1.1 will work for you.

Those fixes solve all the issues I've encountered with old projects, so hopefully they'll do that for you too.

if you ran into other issues , share them with me in the comments

ย 
Share this