make the program work properly without the need to download a new gradle

Viewed 87

I get an Android project from git (clone) When I want to run it with android studio, it takes a lot of time to download the new gradle.
Is there a way to prevent this from happening and make the program work properly without the need to download a new gradle?

1 Answers

You can change the version of the gradle of this project to the gradle version that already you've on android-studio. To do that you can use a text editor to change:

  1. In myAppName\gradle\wrapper\gradle-wrapper.properties file, in the line distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip: change to the gradle version you've (so you need to change this number in your example 6.7.1)

You can know the gradle version you have from C:/Users/myUserName/.gradle/wrapper/dists/

  1. In myAppName\build.gradle you need to change the gradle plugn version to be matched with the gradle distribution version you've from step no.1. Documentation table that lists which version of Gradle is required for each version of the Android Gradle plugin.

There is another way but it's tedious:

  1. First download the github project as a zip file, and extract it.
  2. Create a new Android Studio Project.
  3. Manually migrate files from the github project to the new project:
  • Copy all the behavior, resources, assets and layout files from the original project to the brand new project.
  • Copy all dependencies from myAppName\app\build.gradle into your project build.gradle (module level)
  • Copy required class paths & repositories from myAppName\build.gradle into your project build.gradle (Project level)
  • Copy data from the manifest file to the one of the new project.
Related