How do I manage SNAPSHOT dependency changes in Android Studio?

I am using Android Studio 0.2.5 with Gradle 1.6. I work with the developer of the library that I use, so when he sends updates to some-library:2.1.5-SNAPSHOT I would like to receive it immediately. I can disable caching for modifying modules in Gradle by setting a resolution strategy as follows:

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

This works great for command line builds, but it looks like Android Studio is still using the old version of some-library-2.1.5-SNAPSHOT . The only workaround I managed to get was to delete myproject.iml and the .idea directory and re-import them into Android Studio, which takes a lot of time and seems unnecessary.

+4
source share
1 answer

Another workaround is to delete the ~/.gradle/caches and then sync the project in Android Studio. This is not ideal, since all your dependencies need to be reloaded, but it is a little less intrusive, which will re-import the project into AS, as @Joe pointed out.

Terminal: rm -rf ~ / .gradle / caches AS: Tools> Android> Sync project with Gradle files (or click the "Sync Project with the Gradle Files button" button)

EDIT
A few more studies and found this little stone .
Just set up your dependency as such ...

 compile ('groupId:artifactId:XXX-SNAPSHOT'){ changing=true } 

Then just run gradle clean assemble in a project that has a SNAPSHOT dependency.

I tried to check if the new added constant became available, and of course it worked.

+2
source

Source: https://habr.com/ru/post/1498077/


All Articles