Gradle - 无法展开zip cardview-v7-23.3.0.aar

时间:2017-08-30 16:56:50

标签: java android gradle

我尝试在我的应用中实施firebase。但是firebase和谷歌播放服务之间存在干扰。 这是我的模块的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.example.nefrin.client"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        incremental true
        javaMaxHeapSize "4g"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'



    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.google.android.gms:play-services:11.0.4'
    compile 'com.github.tajchert:nammu:1.1.3'
    compile 'gun0912.ted:tedpermission:1.0.3'
    compile 'com.github.jksiezni.permissive:permissive:0.2'
    compile 'com.github.arimorty:floatingsearchview:2.0.3'
    //compile 'net.sf.sprockets:sprockets-android:4.0.0'
    compile 'com.github.michael-rapp:android-material-dialog:4.0.2'
    compile 'com.github.bumptech.glide:glide:3.5.2'

    compile 'com.google.firebase:firebase-auth:11.2.0'


}
apply plugin: 'com.google.gms.google-services'

这是项目的build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:3.1.0' // google-services plugin

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

allprojects {
    repositories {
        jcenter()
        maven {
            url "https://jitpack.io"
        }
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots'
        }
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }

    }

}

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

当我尝试运行应用程序时,我得到了尽管我没有在我的应用程序中使用cardview:

Error:Execution failed for task ':app:prepareComAndroidSupportCardviewV72330Library'.
> Could not expand ZIP 'C:\Users\Nefrin\.gradle\caches\modules-2\files-2.1\com.android.support\cardview-v7\23.3.0\abdf83a0192c03ff190f941c6c885af18d257a2c\cardview-v7-23.3.0.aar'.

Android Studio强调编译'com.google.android.gms:play-services:11.0.4'并说:

All com.google.android.gms libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.2.0, 11.0.4. Examples include com.google.android.gms:play-services-basement:11.2.0 and com.google.android.gms:play-services:11.0.4 less... (Ctrl+F1) 

    There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion.)

2 个答案:

答案 0 :(得分:0)

由于错误说所有谷歌图书馆应该使用相同的版本 所以你应该更新play-services库并使用与firebase相同的版本:

compile 'com.google.android.gms:play-services:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'

答案 1 :(得分:0)

您需要更改以下代码行:

compile 'com.google.android.gms:play-services:11.0.4'

compile 'com.google.android.gms:play-services:11.2.0'

希望它有所帮助。