cometchat / chat-sdk-android

Text Chat SDK for Android
https://www.cometchat.com
22 stars 12 forks source link

Could not resolve com.squareup.okhttp3:okhttp:3.12.+ #28

Closed rsanjuan87 closed 4 years ago

rsanjuan87 commented 4 years ago

Hi a have added the

implementation 'com.cometchat:pro-android-chat-sdk:2.0.3'
implementation 'com.squareup.okhttp3:okhttp:3.12.+'

to my project dependencies Android Studio build ok while only while is online. when is offline show this error, what I can do?

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.squareup.okhttp3:okhttp:3.12.+

what I can do?

adityagokula2210 commented 4 years ago

Hello @rsanjuan87 Can you please disable the offline mode once and sync gradle once to make sure that the dependencies have been downloaded correctly. Incase you still face the same issue, please share with me both app and project level gradle files for your project so that i can try and replicate this at my end and provide you with a solution at the earliest.

Thanks

rsanjuan87 commented 4 years ago

Android Studio builds OK when is Online, but when I need to build Offline that happend Here are my build.gralde files files.zip

rsanjuan87 commented 4 years ago

Any solution?

adityagokula2210 commented 4 years ago

@rsanjuan87 i have a couple of questions i need to ask:

  1. Any specific reason why you are using offline mode.
  2. Can you provide me with the version of the Android Studio you are using
  3. Can you once switch to online mode..invalidate the caches and restart Android Studio and then try again in offline mode. The only possible reason i can see for this is that the okhttp dependency is not downloaded correctly and thus causing the issue.
  4. Does everything work fine if the CometChat dependency is removed ? Do let me know if this works Thanks
rsanjuan87 commented 4 years ago

@adityagokula2210 1) I use offline mode because I don't have a full time connection 2) I have the latest Android Studio, but even with 3.6.1 use to build offline without comet 3) I already clean, invalidate and restart that a few times, sync, build run online like, I use to do and then do everything offline 4) if I remove cometChat dependency and all work made with chat, my project builds even offline

Waiting news

rsanjuan87 commented 4 years ago

Any news?

adityagokula2210 commented 4 years ago

Hey @rsanjuan87 Can you please run the command

gradlew app:dependencies

and share the output with me

Thanks

rsanjuan87 commented 4 years ago

here is the output

app_dependencies.log

thanks

Hey @rsanjuan87 Can you please run the command

gradlew app:dependencies

and share the output with me

Thanks

rsanjuan87 commented 4 years ago

Any solution?

adityagokula2210 commented 4 years ago

Hello @rsanjuan87 Unfortunately i could not replicate this at my end. However, while digging into this i did encounter the below issue created for gradle which is exactly the same thing that is happening in your case https://github.com/gradle/gradle/issues/10934 Do let me know if the workarounds mentioned in the issue work for you. In case , you are still facing the issue. please let me know so that i can try to figure out some other workaround for this case.

Thanks

rsanjuan87 commented 4 years ago

Thanks a lot!!! that works !!! You rocks!!!

Hello @rsanjuan87 Unfortunately i could not replicate this at my end. However, while digging into this i did encounter the below issue created for gradle which is exactly the same thing that is happening in your case gradle/gradle#10934 Do let me know if the workarounds mentioned in the issue work for you. In case , you are still facing the issue. please let me know so that i can try to figure out some other workaround for this case.

Thanks

rsanjuan87 commented 4 years ago

What I did

android{
    ...
    configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.squareup.okhttp3') {
                details.useVersion '3.12.+'
                details.because 'just becasuse :D'
            }
        }
    }
}