Android Studio-程序类型已存在:com.google.android.gms.internal.measurement.zzwp

Cai*_*újo 84 android jar firebase android-studio

昨天,我的应用程序工作正常.

今天,我不知道为什么,在重新打开Android Studio后,应用程序不再编译了.

显示的错误是

Program type already present: com.google.android.gms.internal.measurement.zzwp
Message{kind=ERROR, text=Program type already present: com.google.android.gms.internal.measurement.zzwp, sources=[Unknown source file], tool name=Optional.of(D8)}
Run Code Online (Sandbox Code Playgroud)

我真的不知道发生了什么,我搜索了一切,没有任何效果.如果有人可以帮助我,我真的很感激.我更改了所有依赖项和库以尝试解决它,但没有任何效果.

这是build.gradle项目

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.1'
        classpath 'com.google.gms:google-services:3.2.1'


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

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle模块:app

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.doctordirectory"
        minSdkVersion 21
        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'
        }
    }
}

repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    implementation fileTree(dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

    implementation ('com.facebook.android:audience-network-sdk:4.28.0',{
        exclude group: 'com.google.android.gms'
    })
    implementation 'com.facebook.android:facebook-login:4.32.0'
    implementation 'com.android.support:multidex:1.0.3'

    implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'

    implementation 'com.android.support:support-v4:27.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.google.firebase:firebase-core:15.0.0'
    implementation 'com.google.firebase:firebase-database:15.0.0'
    implementation 'com.google.firebase:firebase-crash:15.0.0'
    implementation 'com.google.firebase:firebase-auth:15.0.0'
    implementation 'com.google.firebase:firebase-storage:15.0.0'
    implementation 'com.firebaseui:firebase-ui-database:3.3.1'

    implementation 'com.google.android.gms:play-services-auth:15.0.0'
    implementation 'com.google.android.gms:play-services-plus:15.0.0'
    implementation 'com.google.android.gms:play-services-location:15.0.0'

    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'

    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

    implementation 'com.stepstone.apprating:app-rating:2.2.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.github.lguipeng:BubbleView:1.0.1'

    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'

    implementation 'com.miguelcatalan:materialsearchview:1.4.0'

    implementation 'com.github.MdFarhanRaja:SearchableSpinner:1.9'

    implementation 'com.github.sillebille:dynamic-calendar:1.0.1'

    implementation 'com.google.api-client:google-api-client:1.22.0'
    implementation 'com.google.api-client:google-api-client-android:1.22.0'
    implementation 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

MJM*_*MJM 93

更新后解决了这个问题firebase dependencies,以最新的一个,例如com.google.firebase:firebase-core:15.0.0,以com.google.firebase:firebase-core:15.0.2 获得从这里最新名单

以下列表中进行的所有其他更改

  dependencies {
        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.constraint:constraint-layout:1.1.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

        implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

        implementation 'com.facebook.android:audience-network-sdk:4.28.0'
        implementation 'com.facebook.android:facebook-login:4.32.0'
        implementation 'com.android.support:multidex:1.0.3'

        implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'

        implementation 'com.android.support:support-v4:27.1.1'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

        implementation 'com.google.firebase:firebase-core:15.0.2'
        implementation 'com.google.firebase:firebase-database:15.0.0'
        implementation 'com.google.firebase:firebase-crash:15.0.2'
        implementation 'com.google.firebase:firebase-auth:15.0.0'
        implementation 'com.google.firebase:firebase-storage:15.0.2'
        implementation 'com.firebaseui:firebase-ui-database:3.3.1'

        implementation 'com.google.android.gms:play-services-auth:15.0.0'
        implementation 'com.google.android.gms:play-services-plus:15.0.0'
        implementation 'com.google.android.gms:play-services-location:15.0.0'

        implementation 'com.android.support:cardview-v7:27.1.1'
        implementation 'com.android.support:recyclerview-v7:27.1.1'

        implementation 'com.squareup.picasso:picasso:2.5.2'
        implementation 'com.squareup.retrofit2:retrofit:2.3.0'
        implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

        implementation 'com.stepstone.apprating:app-rating:2.2.0'
        implementation 'com.android.support:design:27.1.1'
        implementation 'com.github.lguipeng:BubbleView:1.0.1'

        implementation 'uk.co.chrisjenx:calligraphy:2.3.0'

        implementation 'com.miguelcatalan:materialsearchview:1.4.0'

        implementation 'com.github.MdFarhanRaja:SearchableSpinner:1.9'

        implementation 'com.github.sillebille:dynamic-calendar:1.0.1'

        implementation 'com.google.api-client:google-api-client:1.22.0'
        implementation 'com.google.api-client:google-api-client-android:1.22.0'
        implementation 'com.google.apis:google-api-services-people:v1-rev4-1.22.0'
    }
Run Code Online (Sandbox Code Playgroud)

2)在顶级build.gradle文件更新 classpath 'com.google.gms:google-services:3.1.1classpath 'com.google.gms:google-services:3.2.1

  • 此解决方案有效.Firebase现在正在分发具有独立版本号的软件包,确保build.gradle上的所有软件包都是最新的软件包. (5认同)

Rag*_*sis 21

我也有这个错误和我解决这个问题的方法

1)更新Firbase版本以独立于Google Play服务版本

implementation "com.google.firebase:firebase-messaging:15.0.2"
Run Code Online (Sandbox Code Playgroud)

您可以在此处查看最新版本https://firebase.google.com/support/release-notes/android#latest_sdk_versions

2)在顶层的build.gradle文件更新谷歌的服务,从3.1.1至3 2 0.1

buildscript {
    dependencies {

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

    }
 }
Run Code Online (Sandbox Code Playgroud)


小智 12

我改变了

__CODE__

__CODE__

有用.


小智 7

Firebase是他们更新版本号的原因,因为他们不关心开发人员.

首先要做的事情.更新项目级gradle中的类路径

dependencies {

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

    }
Run Code Online (Sandbox Code Playgroud)

接下来,无论您使用什么工具,如分析,动态链接等等.使用适当的版本化依赖项.

https://firebase.google.com/support/release-notes/android
Run Code Online (Sandbox Code Playgroud)

在我的情况下,我通过远程配置使用A/B测试,所以我需要更新它

implementation 'com.google.firebase:firebase-config:15.0.0'
Run Code Online (Sandbox Code Playgroud)

implementation 'com.google.firebase:firebase-config:15.0.2'
Run Code Online (Sandbox Code Playgroud)

这应该没有任何故障.此外,请将此类问题发布到Firebase,以便他们不会在没有单挑或没有适当文档的情况下进行此类更改.

  • “ Firebase是他们更新版本号的原因,就像他们不在乎开发人员一样。” 说得好 (2认同)

小智 5

删除包含“ com.google.android.gms”的依赖项,然后尝试重建项目...您必须点击n尝试,因为有一些依赖项在其中使用了两次

例如com.android.support:design加twise


Khe*_*raj 5

更新您的Firebase依赖项。

1.项目级别build.gradle

google.gms版本更新到最新。跟踪最新版本。回答时最新是4.1.0

buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:4.1.0' // google-services plugin
    }
}

allprojects {
    // ...
    repositories {
        // ...
        google() // Google's Maven repository
    }
}
Run Code Online (Sandbox Code Playgroud)

2.应用程序级别build.gradle

如果使用任何依赖项,请更新以下依赖项。请注意, firebase现在为每个依赖项提供了单独的版本。

使用最新的Firebase库。在回答时,最新版本如下。

Firebase Core                com.google.firebase:firebase-core:16.0.3
Ads                          com.google.firebase:firebase-ads:15.0.1
Analytics                    com.google.firebase:firebase-analytics:16.0.3
App Indexing                 com.google.firebase:firebase-appindexing:16.0.1
Authentication               com.google.firebase:firebase-auth:16.0.3
Cloud Firestore              com.google.firebase:firebase-firestore:17.1.0
Cloud Functions              com.google.firebase:firebase-functions:16.1.0
Cloud Messaging              com.google.firebase:firebase-messaging:17.3.2
Cloud Storage   c            om.google.firebase:firebase-storage:16.0.2
Crash Reporting              com.google.firebase:firebase-crash:16.2.0
Crashlytics                  com.crashlytics.sdk.android:crashlytics:2.9.5
Dynamic Links                com.google.firebase:firebase-dynamic-links:16.1.1
Invites                      com.google.firebase:firebase-invites:16.0.3
In-App Messaging             com.google.firebase:firebase-inappmessaging:17.0.1
In-App Messaging Display     com.google.firebase:firebase-inappmessaging-display:17.0.1
ML Kit: Model Interpreter    com.google.firebase:firebase-ml-model-interpreter:16.2.0
ML Kit: Vision               com.google.firebase:firebase-ml-vision:17.0.0
ML Kit: Image Labeling       com.google.firebase:firebase-ml-vision-image-label-model:15.0.0
Performance Monitoring       com.google.firebase:firebase-perf:16.1.0
Realtime Database            com.google.firebase:firebase-database:16.0.2
Remote Config                com.google.firebase:firebase-config:16.0.0
Run Code Online (Sandbox Code Playgroud)

3.不要忘记Google插件

另外,不要忘记apply plugin: 'com.google.gms.google-services'在应用程序级别build.gradle的底部添加。

同步和构建...