Avoid gradle cache for snapshot versions

I work with versions of some versions of the SNAPSHOT library in Android Studio.

The problem is that Gradle seems to be using a cached version of these libraries, rather than updating a new updated version .

I tried using something like this in my Gradle script, but it does not work.

dependencies { compile ('myGroupId:myArtifactId:XYZ-SNAPSHOT'){ changing=true } } 

The only workaround that seems to work is to remove the ~/.gradle/caches and then re-sync the project in Android Studio. Of course, this is not a good solution.

How can we work with snapshots?

+7
android android-studio android-gradle build.gradle gradle
source share
2 answers

Try adding this to your gradle script:

 configurations.all { resolutionStrategy.cacheChangingModulesFor 0, 'seconds' } 

Additional information: http://gradle.org/docs/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html

+2
source share

You can also use the gradle --refresh-dependencies

The -refresh-dependencies parameter tells gradle to ignore all cached entries for permitted modules and artifacts. A new solution will be executed for all configured repositories, with dynamic versions, recounted, updated modules and downloadable artifacts ....


I myself created a new gradle run command called refresh that calls ./gradlew --refresh-dependencies clean

run debug configuration screenshot

+12
source share

All Articles