Issue #351

From Gradle tips and recipes, Configure project-wide properties

For projects that include multiple modules, it might be useful to define properties at the project level and share them across all modules. You can do this by adding extra properties to the ext block in the top-level build.gradle file.

ext {
    navigationVersion = "2.0.0"
}

rootProject.ext.navigationVersion

Versions are used mostly in dependencies block so having them defined in global ext is not quite right. We can use def to define variables

dependencies {
    def navigationVersion = "2.0.0"
    implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
}

For better namespacing, we can use a class

class Version {
    static def navigation = "2.0.0"
    static def drawerLayout = "1.0.0"
    static def koin = "2.0.1"
    static def moshi = "1.8.0"
}

dependencies {
    implementation "androidx.navigation:navigation-fragment-ktx:$Version.navigation"
}