Refactors build.gradle for better dependency management.