gradle build fail Error: Failed to resolve: com.an

2019-02-25 13:53发布

问题:

Failed to resolve: com.android.support:cardview-v7:24.0.1 and ) Failed to resolve: com.android.support:appcompat-v7:24.0.1

this is the gradle configuration what i need to do solve this please help me

apply plugin: 'com.android.application'

    compileSdkVersion 24
    buildToolsVersion '24.0.1'
    defaultConfig {
        applicationId 'com.fanbaseafrica.fabaservices'
        minSdkVersion 14
        targetSdkVersion 24
        versionCode 2
        versionName '2.0'
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false

            signingConfig signingConfigs.config

            renderscriptOptimLevel 3
        }
        debug {
            debuggable true
        }
    }
    productFlavors {
    }
}
repositories {
    jcenter()

}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:cardview-v7:24.0.1'
    compile 'com.android.support:appcompat-v7:24.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:design:24.0.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.google.code.gson:gson:2.2.3'
    compile 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:recyclerview-v4:24.0.1'
    compile 'com.android.support:support-v7:24.0.1'
    compile 'com.koushikdutta.ion:ion:2.1.6'
    compile 'com.sprylab.android.texturevideoview:texturevideoview:1.1.1'
}

回答1:

It happens because the support libraries with 24.0.1 don't exist.

Change with a valid version all your supppor libraries dependencies:

24.0.0
24.1.0
24.1.1
24.2.0

Here all the history.

Also some dependencies are wrong:

Change:

compile 'com.android.support:recyclerview-v4:24.0.1'

with

compile 'com.android.support:recyclerview-v7:24.X.X'

The 'com.android.support:support-v7:24.X.X' doesn't exist.

Use

compile 'com.android.support:support-v4:24.x.x'.