OkHTTP not allowed in Android Studio

I am using Android Studio 2.2.3

I am having problems using okhttp and this always gives me:

Error:(49, 13) Failed to resolve: com.squareup.okhttp3:okhttp:3.2.0

Even when I try to import it and the error is displayed below the line.

This is the gradle:

 apply plugin: 'com.android.application'

android {

    lintOptions {
        abortOnError false
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.example.yara.prototype"
        minSdkVersion 15
        targetSdkVersion 25
        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 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.android.support:appcompat-v7:25.0.1'
    compile 'com.firebase:firebase-client-android:2.5.0'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-crash:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    compile 'com.google.android.gms:play-services-auth:10.0.1'
    compile 'com.android.support:design:25.0.1'
    testCompile 'junit:junit:4.12'
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
}
repositories {
    jcenter()
    maven { url "https://jitpack.io" }
    mavenCentral()
}
apply plugin: 'com.google.gms.google-services'

      

+3


source to share





All Articles