Matteo Pagliarello
Matteo Pagliarello

Reputation: 191

Implementation OKHTTP doesn't work on Android project

i followed this tutorial: https://www.journaldev.com/13629/okhttp-android-example-tutorial But when i try to start the project give me this error:

Execution failed for task ':app:checkDebugAarMetadata'.
 Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
    Could not find com.squareup.okhttp3:okhttps:3.4.1.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/squareup/okhttp3/okhttps/3.4.1/okhttps-3.4.1.pom
       - https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttps/3.4.1/okhttps-3.4.1.pom
       - https://jcenter.bintray.com/com/squareup/okhttp3/okhttps/3.4.1/okhttps-3.4.1.pom
     Required by:
         project :app

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

And exactly when i try to write the implementation 'com.squareup.okhttp3:okhttps:3.4.1'

Upvotes: 0

Views: 2926

Answers (1)

Abhishek Yadav
Abhishek Yadav

Reputation: 361

Use this in your build.gredle file

 dependencies {    
        //Retrofit
        implementation 'com.squareup.retrofit2:retrofit:2.9.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
        implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
        implementation 'com.squareup.okhttp3:okhttp:4.9.0'
        implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.4.1'
    }

This may Help someone

Upvotes: 3

Related Questions