添加firestore后错误无法访问zza

时间:2018-05-19 10:04:58

标签: android firebase build.gradle google-cloud-firestore

我已经在我的gradle中添加了Firestore,当我正确同步它的同步时,但是当我运行项目时,我收到了这个错误。

error: cannot access zza class file for com.google.android.gms.common.internal.safeparcel.zza not found

这是我的gradle文件依赖项

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.sothree.slidinguppanel:library:3.4.0'
compile 'com.github.florent37:singledateandtimepicker:1.2.2'
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:8.7.0'
testCompile 'junit:junit:4.12'
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile 'com.chabbal:slidingdotsplash:1.0.2'

implementation 'com.google.firebase:firebase-firestore:16.0.0'

}

2 个答案:

答案 0 :(得分:1)

要解决此问题,请更改以下代码行:

compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'

//compile 'com.google.android.gms:play-services:15.0.1' //(Must be commented)
compile 'com.google.android.gms:play-services-maps:15.0.1'

也一定要使用:

classpath 'com.google.gms:google-services:3.3.1'

build.gradle(项目)文件中。

答案 1 :(得分:0)

Firebase现在正在分发带有独立版本号的软件包,确保build.gradle上的所有软件包都是最新的

将所有Google依赖关系更新为最新版本,例如在您的问题中需要更新以下行,同时使用complie更改implementation

    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'


    implementation 'com.google.android.gms:play-services:15.0.1'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'

    implementation 'com.google.firebase:firebase-firestore:16.0.0'