문제

When Android Studio creates a project, the top-level build file has two repositories definitions, one inside buildscript and another inside allprojects.

// Top-level build file where you can add configuration options common to all sub-    projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

Where must I add another repository and why?

I think that repository inside buildscript is here to add the gradle plugin dependency, but I'm not sure...

Someone could clarify me, please.

Thank you!

도움이 되었습니까?

해결책

The buildscript is for dependencies of your build files. You want to add a repository there if, for example, a task in your build.gradle needs a plugin that is not found in the standard Gradle distribution, like a gwt wrapper.

The allprojects is for dependencies needed by your application, like log4j, Guice, Guava and so on.

Also, be warned that using mavenCentral for retrieving dependencies is a bit discouraged, because if the network is down or if the project is removed from their repositories, you won't be able to build your project anymore

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top