forresthopkinsa / StompProtocolAndroid

Websockets on Android
MIT License
11 stars 4 forks source link

Cannot resolve Stomp.ConnectionProvider #1

Closed ElviraTagny closed 6 years ago

ElviraTagny commented 6 years ago

Hello, I'm trying to connect to a server without using a SSL certificate (trying to bypass "server refuses handshake" error) so I searched on internet, found this fork and tried out the solution provided but Stomp.ConnectionProvider doesn't seem to exist, it cannot be resolved in my IDE (Android studio)

My build.gradle (app): compile 'com.github.NaikSoftware:StompProtocolAndroid:1.4.2' compile 'com.github.forresthopkinsa:StompProtocolAndroid:1.3.1' compile 'org.java-websocket:Java-WebSocket:1.3.4' compile 'com.squareup.okhttp3:logging-interceptor:3.8.0' compile 'com.squareup.okhttp3:okhttp:3.8.0'

My build.gradle (project): .... allprojects { repositories { jcenter() mavenCentral() maven { url "https://jitpack.io" } } } ... Please help !

forresthopkinsa commented 6 years ago

First things first, it's a bad idea to have two different versions of StompProtocolAndroid in the same project. So, before going any further, I recommend that you comment out the upstream version, Naik's.

Now, with that out of the way, clean and rebuild your project (and in Android Studio, re-sync Gradle) and then show me the code that's not working. Is it just not finding the dependency, or is it specifically ConnectionProvider that's not working?

ElviraTagny commented 6 years ago
screen shot 2017-09-19 at 18 04 29

Ok done, but same issue. It's specifically ConnectionProvider that's not working For some reason, it cannot be resolved

here is the code:

import okhttp3.WebSocket;
import ua.naiksoftware.stomp.Stomp;
import ua.naiksoftware.stomp.client.StompClient;

private StompClient mStompClient;

public void init(){
mStompClient = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "ws://echo.websocket.org");
mStompClient.connect();
...
}
forresthopkinsa commented 6 years ago

This is super weird. I'm investigating it on my side right now. In the meantime, try flushing all your caches, re-syncing Gradle, restarting Android Studio, etc., because this does look a lot like a Gradle-out-of-sync issue.

Let me know if your Gradle log shows any errors.

ElviraTagny commented 6 years ago

Super weird indeed :-( I tried everything... not working Something to do with the version of dependency maybe??

forresthopkinsa commented 6 years ago

Maybe. Try using 17.09.0 instead, see if anything changes.

EDIT: Changed to reflect new release published just now

ElviraTagny commented 6 years ago

Ok I did this: Changed the version to 17.09.0 Then added maven { url 'http://clojars.org/repo' } to my build.gradle because I was having a dependency issue Tried to implement this code : StompClient client = Stomp.over(Stomp.ConnectionProvider.OKHTTP, SERVER_ADDRESS, null, getUnsafeOkHttpClient()); with getUnsafeOkHttpClient() method taken from here
but now having compilation issue... I gotta find another (simple) workaround now because I don't know where this is leading me...

forresthopkinsa commented 6 years ago

What error are you getting?

If you post the errors you get, I can help fix them, but I can't do anything with "compilation issue".

forresthopkinsa commented 6 years ago

Any updates? Did you get it working?

forresthopkinsa commented 6 years ago

Closing due to no response