Android Studio- Program type already present: com.google.android.gms.internal.measurement.zzwp

前端 未结 14 1208
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 01:35

Yesterday,my app was working fine.

Today, I don\'t know why, the app didn\'t compile anymore after I reopened the Android Studio.

The error shown is

相关标签:
14条回答
  • 2020-11-30 01:54

    I've got this error too and my solution to this problem

    1) Update Firbase version to be independent from Google Play services version

    implementation "com.google.firebase:firebase-messaging:15.0.2"
    

    You can check latest version here https://firebase.google.com/support/release-notes/android#latest_sdk_versions

    2) In top level build.gradle file update google-services from 3.1.1 to 3.2.1

    buildscript {
        dependencies {
    
            classpath 'com.google.gms:google-services:3.2.1'
    
        }
     }
    
    0 讨论(0)
  • 2020-11-30 01:54

    Firebase is the reason they are updating version numbers like they don't care about the developers.

    First things first. Update the classpath in project level gradle

    dependencies {
    
            classpath 'com.google.gms:google-services:3.2.1'
    
        }
    

    Next, Whatever the tools you might be using like analytics, dynamic links, and so forth. Use the appropriate versioned dependency.

    https://firebase.google.com/support/release-notes/android
    

    In my case, I was using A/B testing through remote config, so I need to update it from

    implementation 'com.google.firebase:firebase-config:15.0.0'
    

    to

    implementation 'com.google.firebase:firebase-config:15.0.2'
    

    This should work without any glitch. And also, please post this kind of issues to Firebase so that they don't do this kind of changes without a heads-up or without a proper documentation.

    0 讨论(0)
  • 2020-11-30 01:54

    For me the problem seemed to be caused by the android build tools

    To fix, I had to downgrade these in mu projects top level build.gradle file

    -        classpath 'com.android.tools.build:gradle:3.1.0'
    +        classpath 'com.android.tools.build:gradle:3.0.1'
    

    I'm aware this is not the best solution, but so far the only thing that worked for me.

    EDIT: Alternatively, add android.enableD8=false to your project gradle.properties file

    0 讨论(0)
  • 2020-11-30 01:54

    Ok, wait a second. I've verified that not all Firebase libraries need that version. The versions are now misaligned. In fact on the official page reports that some are at 15.1.0 instead of 15.0.2;

    Maybe see directly here if it can be useful:

    https://firebase.google.com/docs/android/setup

    0 讨论(0)
  • 2020-11-30 01:57

    I had a similar situation with this error:

    Program type already present: com.google.android.gms.internal.*

    I was using OneSignal and React native maps at the same time, I excluded gms from both and included it at the upper level.

    See the troubleshooting section here: https://github.com/react-native-community/react-native-maps/blob/master/docs/installation.md#troubleshooting

    0 讨论(0)
  • 2020-11-30 01:59

    Resolved this issue after updating a firebase dependencies to latest one for example com.google.firebase:firebase-core:15.0.0 to com.google.firebase:firebase-core:15.0.2 Get Latest List from here

    All other changes made in below list

      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'
        }
    

    2) In top level build.gradle file update from classpath 'com.google.gms:google-services:3.1.1 to classpath 'com.google.gms:google-services:3.2.1

    0 讨论(0)
提交回复
热议问题