Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid gradle cache for the snapshot versions

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?

like image 521
Gabriele Mariotti Avatar asked Apr 20 '15 11:04

Gabriele Mariotti


1 Answers

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

run debug configuration screenshot

like image 164
whlk Avatar answered Sep 27 '22 01:09

whlk