所以我尝试删除Firebase配置,然后我可以启动该应用程序,并且一切正常。 但是,如果我尝试进入gradle缓存并尝试删除Firebase库的重复类,则android studio将重新下载它们,但仍然无法正常工作。 我还尝试使这些库脱机,并将它们放入libs文件夹中,然后导入和删除这些类,但是启动应用程序时会崩溃。 我的Gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
multiDexEnabled true
applicationId "jalaleddine.abdelbaset.dowAnghami"
minSdkVersion 19
targetSdkVersion 28
versionCode 5
versionName "1.03"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//implementation 'com.github.or-dvir.EasySettings:easysettings-basic:1.1.3'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
//implementation group: 'com.google.android.gms', name: 'play-services-tasks', version: '16.0.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
implementation 'com.google.firebase:firebase-config:16.1.0'
testImplementation 'junit:junit:4.12'
//mdepras?
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.asha.nightowllib:nightowllib:0.2'
//noinspection GradleDependency
//implementation 'com.google.android.gms:play-services-measurement:17.0.1'
//implementation 'com.google.android.gms:play-services-measurement-sdk:17.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.google.code.findbugs:jsr305:1.3.9'
//implementation 'com.google.firebase:firebase-analytics:17.0.1'
// Add the SDKs for any other Firebase products you want to use in your app
// For example, to use Firebase Authentication and Cloud Firestore
//implementation 'com.google.firebase:firebase-auth:16.0.4'
// implementation 'com.google.firebase:firebase-firestore:20.2.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
//youtube data api v3 dependency
//excluding org.apache.httpcomponents so as to resolve anonymity
implementation('com.google.apis:google-api-services-youtube:v3-rev192-1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
//dependency for JSON support
implementation files('libs/gson-2.1.jar')
// implementation files('libs/jsr305-1.3.9')
//dependency for finding bugs
implementation files('libs/jsr305-1.3.9.jar')
//implementation 'com.google.firebase:firebase-config:18.0.0'
//YouTubeAndroidPlayerApi for playing youtube videos
//implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
尝试在手机上启动该错误:
Duplicate class com.google.android.gms.internal.measurement.zzsr found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.internal.measurement.zzss found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.internal.measurement.zzst found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.internal.measurement.zzsu found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.internal.measurement.zzsv found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzcu found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzcv found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzcw found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzcx found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzcy found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Duplicate class com.google.android.gms.measurement.internal.zzdw found in modules classes.jar (com.google.android.gms:play-services-measurement-base:16.3.0) and classes.jar (com.google.firebase:firebase-analytics-impl:16.2.2)
Go to the documentation to learn how to Fix dependency resolution errors.
答案 0 :(得分:0)
如果要删除Firebase配置,则需要从Gradle文件中完全删除Firebase依赖项。
如果要使用Firebase,则需要更新Firebase依赖关系。
当您在Gradle中添加消息传递服务时,zzsr found
错误将消失。
implementation 'com.google.firebase:firebase-messaging:11.8.0