codernaut / citizenconnect

Apache License 2.0
1 stars 9 forks source link

Make dependencies versions as variables for easier maintenance and better readability #7

Open wahibhaq opened 6 years ago

wahibhaq commented 6 years ago

Its a widely known best practice among android folks to avoid hardcoding version numbers of dependencies inside app/build.gradle. Instead its recommended to store it either in root build.gradle or in the same gradle file but as variables and then refer these variables.

It makes it much easier to update because then you can reuse one variable in different dependency and also easier to read for other contributors.

For example in root build.gradle

supportLib = '27.0.2'

and in app/build.gradle

// App's support dependencies
  implementation "com.android.support:appcompat-v7:$rootProject.supportLib"
  implementation "com.android.support:support-v4:$rootProject.supportLib"