Reputation: 29867
I'm just getting use to Gradle and Android Studio. I notice that Android Studio projects can have multiple build.gradle files. There is one located in the project's root folder and there's a second one located in the project's app folder. Can someone explain what the purpose of having these two are? When I do a build in AS, are both used or just one of them (and if only one of them, which one)?
Upvotes: 10
Views: 5238
Reputation: 9474
If your project contains multiple modules, you may use the root (project-level) build.gradle file to keep configuration common to all modules. E.g. you may put common dependencies there.
Default top-level build.gradle for Android Studio has "allprojects" block in the top-level build.gradle that adds "jcenter" repository to every module.
Upvotes: 4