Question: can I define the url where a dependency ...
# gradle
t
Question: can I define the url where a dependency is located myself? I'm a dependency on compose, but it attaches
-samplessources
for some reason. Without that, it should be able to resolve the dependency..
v
Can you show some reproducer with your problem? Defining a dependency url sounds like at most symptom treatment
t
Thanks for the quick response. Found the solution: I have in my root-file two locations with repositories:
Copy code
buildscript {
   repositories{
       //1
   }
}

repositories {
    //2
}

allprojects {
    repositories{
        //3
    }
}
I don't exactly know the difference, but I only had it in 1 and 2, but it should have also been in 3... Sorry for bothering...
v
Well, yes and no. If you have 3, there is no need for 2, as 3 already includes 2
1 is for resolving dependencies in the buildscript block that are needed for the compilation of the actual build script
2 is for resolving dependencies for the actual code built by the current project
3 is for the same as 2 but not only in the current project but also in all subprojects
With 6.8 you could also use the more idiomatic and appropriate approach to declare it for all projects in the settings script
t
thank you for all your info, I will look at 6.8 now. Gradle becomes clearer and clearer to me and I love it more and more! Just out of curiosity: do you know why it would attach
-samplessources
?
👌 1
hmm after moving dependencies to dependencyResolutionManagement android studio is not resolving the libraries anymore... They are added to the external libraries, but not as a library for a KMP-module and so the references are not resolved.
v
How did you move your "dependencies"? Or did you mean "repositories"?
t
ah, I mean repositories
So strangely enough, it's even the case for other KMP-modules which are located in the same project.
v
I have no idea. I use it with latest IntelliJ and there it works fine. But I don't think that it could be due to AS being based on an older IJ version, I don't think this feature should need IDE changes.
t
Its building correctly, so it must probably be a setting: delegate something to gradle or do it themselves?
AS has a list with repositories where all the repositories are listed, so it's even more strange... Updating to artic fox canary 4, see if that helps...
hmm, got the samplessources again... Maybe it's something about internet-connection? I'll check tomorrow
v
Still just guessing game unless you show code. 🙂
r