0

In my Gradle script I'm using some library dependecies like

implementation "com.example:myLibrary:+"

I now want to display in the app which version acutally is used. The easiest way for this would be using a BuildConfigField which holds the version information. But how can I find out which version gradle acutally downloads. Is there a way to determine this in gradle or do I have to extract it from the path as described here?

Thommy
  • 5,070
  • 2
  • 28
  • 51

1 Answers1

1

You can try this :

configurations.implementation.filter { it.name.contains('myLibrary') }.each { 
    println 'version : ' + it.name.take(it.name.lastIndexOf('.')).split('-').last()
} 
ToYonos
  • 16,469
  • 2
  • 54
  • 70
  • `implementation` does not work with current gradle Versions. But it's a good start to continue from. Thanks for that. – Thommy Jun 28 '18 at 13:31
  • 1
    In newer Gradle versions `Resolving configuration 'implementation' directly is not allowed` – Thommy Jun 29 '18 at 06:41