While checking out my own projects or others projects from github, android studio first tries to download gradle version mentioned in that project. However downloading so many versions of gradle takes up space, time and I dont want so many versions of them. But I can not find a way to change the gradle version and sync project with newer gradle version. I tried editing the build.gradle file with classpath of newer gradle but that did not work. What can I do to sync projects without downloading an older version of gradle? I understand the possibility of not working or syncing project properly with another gradle version but is this possible?
Below image shows, classpath changed and tried to resync but still downloaded older gradle version mentioned in the file while syncing, so kept as is.
CodePudding user response:
You could possibly turn off your internet on your PC before opening this project. There would be a prompt asking you to run the project offline, if you click Yes, it might throw an error saying dependencies not found and that could be the time when you could change the target versions.
But nevertheless, the size of the old gradle versions will be just around 100 mb which should have a huge impact on your storage.
CodePudding user response:
If you want to run that project you need to download that particular gradle build. If you try otherwise it will be waste of your time. Trust me I've tried.
CodePudding user response:
What you tried to change is the Android Gradle plugin not Gradle executable itself. To change Gradle's version you need to open file gradle/wrapper/gradle-wrapper.properties
and then change to the version you expect there. Be aware that there's a relation between the Android Gradle plugin and Gradle versions so they might not play nice together, that's why Google did this: https://developer.android.com/studio/releases/gradle-plugin#versioning-update