Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio handle SNAPSHOT dependencies

I'm having some troubles by using a SNAPSHOT dependency on Android Studio 3.0.1. I've also tried Android Studio 3.1, and the same issue remains.

I'm including the dependency in the following way:

dependencies {
    configurations.all {
        resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
        resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
    }
    implementation('com.example:lib:0.0.1-SNAPSHOT') { changing = true }
}

When a new version of the library is published, if I click the "Refresh all Gradle projects" icon, the app builds fine. However, Android Studio doesn't see any change made in the snapshot.

I've already tried to restart Android Studio and to invalidate its cache, without any difference.

How to make Android Studio aware of the changes?

like image 299
Spotlight Avatar asked Jan 10 '18 13:01

Spotlight


People also ask

What are snapshot dependencies?

Snapshot Dependencies By setting a snapshot dependency of a build (for example, build B) on another build's (build A) sources, you can ensure that build B will start only after build A is run and finished. We call build A a dependency build, whereas build B is a dependent build.

Where can I find dependencies in android studio?

Go to File > Project Structure in Android Studio. Select the app module in the Modules list on the left. Select the Dependencies tab. Click the + button on the lower left to add the dependency.

What is difference between snapshot and version in Maven?

A Maven snapshot is a special version of a Maven package that refers to the latest production branch code. It is a development version that precedes the final release version. You can identify a snapshot version of a Maven package by the suffix SNAPSHOT that is appended to the package version.

What are Android dependencies?

Dependency injection (DI) is a technique widely used in programming and well suited to Android development. By following the principles of DI, you lay the groundwork for good app architecture. Implementing dependency injection provides you with the following advantages: Reusability of code. Ease of refactoring.


2 Answers

I have the same problem. So far, what works for me is to refresh the dependencies through the command line:

./gradlew clean --refresh-dependencies

After that, quit AS completely and open it again. I'll update my answer if I find something else.

like image 153
Fco P. Avatar answered Oct 16 '22 15:10

Fco P.


It is a bug in studio 3.1 -> https://issuetracker.google.com/issues/72614343

Fixed in latest Canary version (3.2)

like image 2
Leonid Buzmacov Avatar answered Oct 16 '22 17:10

Leonid Buzmacov