2015-11-23 68 views
3

我正在使用Retrofit 2.0.0-beta2庫進行與API的通信。直到上週五,一切正常。今天我得到這個錯誤:無法解析:okhttp登錄攔截器

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

我不能擺脫它。我已經在網上搜索,但似乎我的gradle這個文件都正確:

的build.gradle(項目)

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' 
} 

當我從依賴關係(這意味着我看不到Retrofit日誌,但我確實希望看到它們)編譯'com.squareup.okhttp:logging-interceptor:2.6.0-SNAPSHOT',一切工作正常。任何人都知道如何解決它?

回答

5

今天logging-interceptor被更新爲2.6.0,你可以在jCenter

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

改變你的build.gradle看到:

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