Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve: okhttp loggin-interceptor

I am using Retrofit 2.0.0-beta2 library for the communication with the API. Until last friday, everything worked fine. Today I get this error:

Failed to resolve: com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT

and I cannot get rid of it. I've search the Internet, but it seems that my gradle files are all right:

build.gradle (Project)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'http://oss.sonatype.org/content/repositories/snapshots' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

build.gradle (app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.package.app"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        //(...)
    }
}

dependencies {
    //(...)
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile 'com.squareup.okhttp:okhttp:2.5.0'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT'
}

When I get rid of the `compile 'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT' from dependencies (which means that I can't see the Retrofit logs, but I do want to see them) everything works fine. Anyone knows how to fix it?

like image 270
fragon Avatar asked Dec 28 '25 04:12

fragon


2 Answers

Today logging-interceptor was updated to 2.6.0 as you can see on jCenter

Change your build.gradle from

dependencies {
    ...
    compile 'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT'
}

to:

dependencies {
    ...
    compile 'com.squareup.okhttp:logging-interceptor:2.6.0'
}
like image 123
Mattia Maestrini Avatar answered Dec 30 '25 21:12

Mattia Maestrini


2.6.0 version is released so you don't need -SNAPSHOT postfix anymore. If you would like to continue to use snapshot versions use 2.7.0-SNAPSHOT instead.

Proof: https://github.com/square/okhttp/issues/2027

like image 43
Sergii Pechenizkyi Avatar answered Dec 30 '25 21:12

Sergii Pechenizkyi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!