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"
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 rootbuild.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
and in
app/build.gradle