Gradle - 无法展开 zip 卡片视图-v7-23.3.0.aar



我试图在我的应用程序中实现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:UsersNefrin.gradlecachesmodules-2files-2.1com.android.supportcardview-v723.3.0abdf83a0192c03ff190f941c6c885af18d257a2ccardview-v7-23.3.0.aar'.

安卓工作室强调编译"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.)

因为错误说所有的谷歌库都应该使用相同的版本
所以你应该更新播放服务库,并使用与firebase:相同的版本

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

您需要更改这行代码:

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

带有

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

希望能有所帮助。

最新更新