错误:无法解决:com.android.support:cardview-v7:23.4.0

时间:2016-06-17 10:44:04

标签: java android gradle android-gradle build.gradle

我试图编译应用程序,但这些错误出现了我该怎么办?

  

错误:无法解决:com.android.support:cardview-v7:23.4.0   错误:无法解决:com.android.support:support-v4:23.4.0   错误:无法解决:com.android.support:customtabs:23.4.0

源代码是

apply plugin: 'com.android.application'
android 
{
    signingConfigs {}
    compileSdkVersion  21
    buildToolsVersion '21.1.2'
    defaultConfig 
    {
        applicationId "com.boonex.oo"
        minSdkVersion 15
        targetSdkVersion 21
    }
    buildTypes 
    {
        release 
        {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    } 
}

repositories 
{
    jcenter() 
}

dependencies 
{
    compile 'com.facebook.android:facebook-android-sdk:4.+'
    compile 'com.google.android.gms:play-services-maps:8.4.0'
    compile 'com.android.support:support-v4:23.1.1' 
}

2 个答案:

答案 0 :(得分:1)

尝试更早版本的Facebook SDK。

compile 'com.facebook.android:facebook-android-sdk:4.0.0'

答案 1 :(得分:0)

兄弟..看看那个..你的compileSdkVersion是21.所以你无法使用更高版本的appCompat gradle。首先,你必须将你的sdk更新为23。

你可以看到我的gradle,它应该是这样的:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    useLibrary 'org.apache.http.legacy'

    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize "4g"
    }

    defaultConfig {
        applicationId "com.apple"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    packagingOptions {
        exclude 'META-INF/license.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
    }
}

dependencies {
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:support-v4:23.3.0'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:design:23.3.0'
    compile project(':library')
    compile files('libs/httpmime-4.3.jar')
    compile files('libs/gcm.jar')
    compile 'com.mcxiaoke.volley:library:1.0.19'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.firebase:firebase-client-android:2.3.1'
    compile files('libs/httpcore-4.3.2.jar')
    compile files('libs/httpclient-4.3.3.jar')
}

configurations {
    all*.exclude group: 'com.android.support', module: 'support-vector-drawable'
    all*.exclude group: 'com.android.support', module: 'animated-vector-drawable'
    all*.exclude group: 'com.android.support', module: 'support-annotations'
}

你可以看到我的compileSdkVesion是23,所以我的每个com.android.support gradle都是23。

很抱歉最近提及..您还需要更改类路径以避免最新版本的兼容性问题。

 classpath 'com.android.tools.build:gradle:2.1.2'

这一切只有在您首先升级sdk时才有可能。