Reputation: 364361
I am working with SNAPSHOT versions of some libraries in Android Studio.
The problem is that Gradle seems to use a cached version of these libraries and doesn't redownload the new updated snapshot version.
I tried to use something like this in my gradle script, but it doens't work.
dependencies {
compile ('myGroupId:myArtifactId:X.Y.Z-SNAPSHOT'){
changing=true
}
}
The only workaround that seems to work is to delete the ~/.gradle/caches
directory and then resync the project in Android Studio.
Of course it is not a good solution.
How can we work with snapshot versions?
Upvotes: 18
Views: 5997
Reputation: 2723
Try adding this to your gradle script:
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
More info: http://gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
Upvotes: 11
Reputation: 15635
You can also use the gradle parameter --refresh-dependencies
The --refresh-dependencies option tells Gradle to ignore all cached entries for resolved modules and artifacts. A fresh resolve will be performed against all configured repositories, with dynamic versions recalculated, modules refreshed, and artifacts downloaded. ...
I for myself created a new gradle run command called refresh which calls ./gradlew --refresh-dependencies clean
Upvotes: 19