代码之家  ›  专栏  ›  技术社区  ›  TurkC

程序类型已存在:com。谷歌。安卓gms。常见的api。zzf公司

  •  10
  • TurkC  · 技术社区  · 7 年前

    在android studio中运行应用程序时,出现以下错误。

    程序类型已存在:com。谷歌。安卓gms。常见的api。zzf公司

    firebase堆芯警告-> 所有gms/firebase库必须使用 相同的版本规范(混合版本可能导致运行时 碰撞)。找到版本12.0.1、10.0.1。示例包括 com。谷歌。安卓gms:游戏服务地下室:12.0.1和 com。谷歌。安卓游戏服务广告:10.0.1以下。。。(Ctrl+F1) 有一些库或工具与库的组合 不兼容,或可能导致错误。这种不相容性之一是 使用Android支持库的版本进行编译 最新版本(尤其是低于 targetSdkVersion)。

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 27
        defaultConfig {
            applicationId "com.fay.flow"
            minSdkVersion 16
            targetSdkVersion 27
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
        annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
        testImplementation 'junit:junit:4.12'
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:27.1.1'
        implementation 'com.github.bumptech.glide:glide:4.6.1'
        implementation 'com.android.support:design:27.1.1'
        implementation 'com.android.support:cardview-v7:27.1.1'
        implementation 'com.android.support:recyclerview-v7:27.1.1'
        implementation 'com.google.firebase:firebase-core:12.0.1'
        implementation 'com.google.firebase:firebase-database:12.0.1'
        implementation 'com.squareup.retrofit2:retrofit:2.3.0'
        implementation 'com.squareup.retrofit2:converter-moshi:2.3.0'
        implementation 'com.facebook.android:audience-network-sdk:4.28.0'
        implementation 'org.jsoup:jsoup:1.7.3'
        implementation 'com.jakewharton:butterknife:8.8.1'
        implementation 'com.r0adkll:slidableactivity:2.0.6'
        implementation 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'
        implementation 'com.etsy.android.grid:library:1.0.5'
    
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    5 回复  |  直到 7 年前
        1
  •  14
  •   TurkC    7 年前

    我的解决方案

    implementation ('com.facebook.android:audience-network-sdk:4.28.0',{
        exclude group: 'com.google.android.gms'
    })
    
        2
  •  8
  •   Vitaly Zinchenko    6 年前

    有相同的错误。如何修复:

    在您使用的依赖项中:

    implementation 'com.google.firebase:firebase-core:12.0.1'
    

    警告说:

    firebase堆芯警告->所有gms/firebase库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本12.0.1、10.0.1。示例包括com。谷歌。安卓gms:游戏服务地下室:12.0.1和 com。谷歌。安卓gms:播放服务广告:10.0.1 较少的

    尝试在您的版本12.0.1(不是10.0.1)中添加此依赖项:

    implementation 'com.google.firebase:firebase-core:12.0.1'
    implementation 'com.google.android.gms:play-services-ads:12.0.1'
    
        3
  •  5
  •   Robert Stevens    7 年前

    当我在android构建中添加两个不同的包(使用react native)时,我遇到了类似的问题。

    问题是他们使用了两个不同版本的google play服务。我可以使用选项1解决此问题:

    选项1:使用项目范围的渐变配置:

    您可以在root/android/build中定义项目范围的属性(推荐)。gradle,并让库自动检测以下属性的存在:

    buildscript {...}
    allprojects {...}
    
    /**
    Project-wide Gradle configuration properties (replace versions as appropriate)
    */
    
    ext {
      compileSdkVersion   = 25
      targetSdkVersion    = 25
      buildToolsVersion   = "25.0.2"
      supportLibVersion   = "25.0.2"
      googlePlayServicesVersion = "11.6.2"
      androidMapsUtilsVersion = "0.5+"
    }
    

    选项2:使用特定的渐变配置:

    如果未定义项目范围的属性或希望使用不同的Google Play Services版本,请改用以下内容(所需版本请切换11.6.2):

      ...
      dependencies {
      ...
      implementation(project(':react-native-google-places')){
          exclude group: 'com.google.android.gms', module: 'play-services-base'
          exclude group: 'com.google.android.gms', module: 'play-services-places'
          exclude group: 'com.google.android.gms', module: 'play-services-location'
      }
      implementation 'com.google.android.gms:play-services-base:11.6.2'
      implementation 'com.google.android.gms:play-services-places:11.6.2'
      implementation 'com.google.android.gms:play-services-location:11.6.2'
      }
    

    在我的项目中,我简单地添加了:

    ext {
      googlePlayServicesVersion = "12.0.1"
    }
    

    到我的android/build。根据选项1的梯度文件。

        4
  •  2
  •   Najaf Ali    6 年前

    什么是ZZF、ZZg、ZZH、ZZ等。无论您遇到什么样的错误,都可以通过更改依赖级别来解决它。有时是因为缺少依赖关系。

    它通常是由于您的依赖项不匹配而发生的,我多次面对并通过更改依赖项级别解决了这一问题。您可以看到以下两种情况,第一种是我得到了zzf错误,但第二种是更改了第一行ads依赖项,所以现在它工作正常

    第一种情况:

    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    
    
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.daimajia.numberprogressbar:library:1.2@aar'
    implementation 'com.amitshekhar.android:android-networking:0.2.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'org.mapsforge:mapsforge-map-android:0.8.0'
    implementation 'com.caverock:androidsvg:1.2.2-beta-1'
    testImplementation 'junit:junit:4.12'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true
    }
    implementation 'com.google.android.gms:play-services-analytics:10.0.1'
    

    第二种情况:

    implementation 'com.google.android.gms:play-services-ads:10.0.1'
    
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.daimajia.numberprogressbar:library:1.2@aar'
    implementation 'com.amitshekhar.android:android-networking:0.2.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'org.mapsforge:mapsforge-map-android:0.8.0'
    implementation 'com.caverock:androidsvg:1.2.2-beta-1'
    testImplementation 'junit:junit:4.12'
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true
    }
    implementation 'com.google.android.gms:play-services-analytics:10.0.1'
    

    在第一种情况下,我得到了错误,但当我在第一行中更改ads相关性时,您可以看到级别10它的正确性,您将在许多关键字中面临此错误,但每次都是由于高级别的相关性不匹配,所以更改它们,希望您会喜欢它。

        5
  •  2
  •   Saurabh Gaddelpalliwar    6 年前

    我解决了这个问题,希望这能对你有所帮助。

    implementation 'com.google.android.gms:play-services-analytics:16.0.4'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-base:16.0.1'