简体   繁体   中英

Added maven to android project

I'm trying to add https://github.com/npgall/concurrent-trees/blob/master/documentation/Downloads.md to my project in the gradle file.

buildscript {
    repositories {
        mavenLocal()
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }
        mavenCentral()
    }
    dependencies{
        compile group: 'com.googlecode.concurrent-trees', artifactId: 'concurrent-trees', version: '2.4.0'
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
    }
}

I'm getting the error:

Gradle DSL method not found: 'compile()'

This is for the specific module. I'm a little confused. What could be causing this?

Looks like you're adding it to your project's build.gradle. Try to add it to dependencies of your module's build.gradle

compile 'com.googlecode.concurrent-trees:concurrent-trees:2.4.0'

Quoting docs

Android Studio configures projects to use the Maven Central Repository by default. (This configuration is included in the top-level build file for the project.)

and

In most cases, you only need to edit the build files at the module level.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM