1

I am using Android Studio 4.0.0. My project requires an earlier version of Gradle, version 4.10.1. I have been failing at this for weeks now. I have tried deleting the gradle folder on my project files, deleting the cache folder in C:/user/user_name/.gradle, I have changed the version on gradle.properties - all I get is an error that i should upgrade to version 6.1.1 of gradle.

Is there something im doing wrong? Please help

  • Have you tried changing distributionUrl=https\://services.gradle.org/distributions/gradle-x.y.z-all.zip in project/gradle/wrapper/gradle-wrapper.properties ? I think then you need to reopen the project so that android studio automatically downloads it. – navid Oct 26 '20 at 07:54

2 Answers2

1

My project requires an earlier version of Gradle, version 4.10.1

That is over two years old. You should set aside some time to address whatever problems are in your build scripts that require an old version of Gradle.

Is there something im doing wrong?

In your project (top-level) build.gradle file, ensure that your com.android.tools.build:gradle dependency is set to 3.3.3:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
  repositories {
    google()
    jcenter()
  }
  dependencies {
    classpath "com.android.tools.build:gradle:3.3.3"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

allprojects {
  repositories {
    google()
    jcenter()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

The Android Gradle Plugin 3.3.3 still supports Gradle 4.10.1. Anything newer does not. See this table of Android Gradle Plugin and Gradle versions.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
1

I have had this same problem yesterday when I inadvertently clicked the warning to update the gradle version on my Flutter project.

After some time, I realized that at least two places changed the version of gradle:

  1. android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
  1. android/build.gradle
buildscript {
    // ...

    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
    }
}

You may want to change the version of those lines to one that corresponds to what you want.

Filipe Fonseca
  • 93
  • 1
  • 11