Error: (28, 13) Failed to solve: com.squareup.okhttp3: okhttp: 3.2.0

I have a problem with android studio.

I added the .jar okhttp file at this link: https://github.com/square/okhttp to my libs directory on my android studio. and when I try to add this line: compile 'com.squareup.okhttp3: okhttp: 3.2.0' in the dependencies in build.gradle (Module: app), after trying to synchronize, I get error 28, 13. In fact, after that I found out that I can’t compile anything in the dependencies and synchronize it with the fact that I checked my “SDK build tool for Android”.

hear all my code in the build.gradle (app) directory:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

 defaultConfig {
        applicationId "com.example.kasra.stormy"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'], )
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile files('libs/okhttp-3.2.0.jar')
    compile 'com.squareup.okhttp3:okhttp:3.2.0'
}

I will be very happy and grateful if anyone can help me fix this problem.

Many thanks:)

+4
4

, JCenter, repositories gradle.

apply plugin: 'com.android.application'

repositories {
    jcenter()
}

, gradle JAR , libs/okhttp-3.2.0.jar , compile files('libs/okhttp-3.2.0.jar').

, , compile files('libs/, compile fileTree(dir: 'libs', include: ['*.jar'], ) JAR libs/.

+4

compile files('libs/okhttp-3.2.0.jar')

0

, build.gradle, :

apply plugin: 'com.android.library'

android {
    compileSdkVersion 24
    buildToolsVersion '25.0.0'

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),         
    'proguard-rules.txt'
        }
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {
    compile project(':library')
    //compile('com.squareup.okhttp3:okhttp:+') {
    //    exclude group: 'org.json'
    //}
    //replaced as below:
    compile 'com.squareup.okhttp3:okhttp:3.9.1'
}
0

build.gradle(app):

implementation 'com.squareup.okhttp3:okhttp:3.10.0'

compile 'com.squareup.okhttp3:okhttp:3.2.0'

, .

0

All Articles