简体   繁体   中英

Gradle build failed to resolve library

I am working on android (Java) and trying to consume websockets so I thought I would use this tutorial and they are using dependency org.java-websocket:Java-WebSocket:1.3.0 from this repo which has now become 1.3.1 .

So I have in my modular build.gradle

dependencies {
    ...
    compile 'org.java-websocket:Java-WebSocket:1.3.1'
    ...
}

and in my project / top level build.gradle I have

repositories {
        jcenter()
        maven { url 'http://clojars.org/repo' }
    }

and I am getting error

Error:(49, 13) Failed to resolve: org.java-websocket:Java-WebSocket:1.3.1

Try it with lowercase:

compile 'org.java-websocket:java-websocket:1.3.1'

It worked for me.

Edit:

the project level gradle file:

buildscript {
    repositories {
        jcenter()
        maven { url 'http://clojars.org/repo' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'http://clojars.org/repo' }
    }
}

我也遇到了同样的问题,我重新启动了Android Studio并再次同步,它构建成功。

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