문제

Just trying Android Studio & Gradle and I want to add Roboguice to my Project, this is my build.gradle:

// 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.8.+'

    }
}



allprojects {
    repositories {
        mavenCentral()
    }
}

dependencies {
    compile 'org.roboguice:roboguice:2.0'
}

gives me

Gradle 'TestApp' project refresh failed:
         Build script error, unsupported Gradle DSL method found: 'compile()'!

I tried to move the line

compile 'org.roboguice:roboguice:2.0'

within the dependencies in buildscript but that also failed.

How is this done correctly?

도움이 되었습니까?

해결책

dependencies {
    compile 'org.roboguice:roboguice:2.0'
}

enter image description hereMove this part from build.gradle in root (top level build file) to build.gradle in your module

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