0

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
CookieMonster
  • 492
  • 6
  • 18

2 Answers2

0

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' }
    }
}
breakline
  • 5,776
  • 8
  • 45
  • 84
  • Tried it but unfortunately the error still appears. – CookieMonster Aug 30 '16 at 16:59
  • You have some obvious other problems. Maybe internet connection? Check if gradle isnt set to offline work. Can you add any other dependencies? As I said I just tried it and it worked for me. You can check the url itself to find the JAR file as well, and its there. Nothing seems to be wrong with your code. – breakline Aug 30 '16 at 17:13
  • Ha. My gradle was set to offline. It works now, thanks! – CookieMonster Aug 30 '16 at 17:24
0

I was also facing same issue ,I restarted Android Studio and sync again,it build successfully.

Taimur
  • 559
  • 11
  • 24