2016-12-19 1 views
1

어떤 이유로 gradle이 (가) 내 의존성을 해결할 수 없습니다. 이 예는 다음과 같습니다Gradle이 (가) 내 의존성을 해결할 수 없습니다.

모듈 :

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "app.simplelogin" 
     minSdkVersion 15 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 

    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.squareup.okhttp3:okhttp:3.0.1' 
    testCompile 'junit:junit:4.12' 
} 

프로젝트 :

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

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     mavenCentral() 
    } 
} 

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

I 동기화하거나 빌드하려고, 나는 다음과 같은 오류 얻을 :

Failed to resolve: com.squareup.okhttp3:okhttp:3.0.1 

나는 이것을 얻는다. 모든 의존성이있는 오류 메시지 추가하려고합니다.

+0

이것은 중복 된 내용입니다. http://stackoverflow.com/questions/34895397/not-able-to-import-com-squareup-okhttp-okhttpclient – aconnelly

+2

@aconnelly : 아니요. 허용 된 대답은 wj1091이 이미 수행하고있는 것입니다. – CommonsWare

+1

Gradle Console 출력을 나열한 메시지 지점에 더 게시 할 수 있습니까? 또한 네트워크에 특별한 점이 있습니까 (예 : 프록시 서버 사용 필요)? – CommonsWare

답변

1

Android Studio의 Gradle 도구 창에서 오프라인 모드를 사용했을 가능성이 높습니다. 오프라인 모드를 끄면 인터넷에 연결되어 있으면 작동합니다.

관련 문제