Android Studio 不会突然构建:程序类型已存在:com.google.android.gms.internal.auth.zzao

Android Studio won't build suddenly: Program type already present: com.google.android.gms.internal.auth.zzao

我的项目 运行 昨天还不错。我今天打开它并收到此错误:

Program type already present: com.google.android.gms.internal.auth.zzao

我尝试更新 firebase 库,然后出现这些错误并且点击安装不起作用:

Failed to resolve: com.google.firebase:firebase-core:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-maps:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-location:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-places:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-auth:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-basement:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-tasks:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog


Failed to resolve: com.google.firebase:firebase-common:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.firebase:firebase-iid:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.firebase:firebase-measurement-connector:17.3.0
Open File
Show in Project Structure dialog


Failed to resolve: com.google.android.gms:play-services-gcm:17.3.0
Install Repository and sync project
Open File
Show in Project Structure dialog

我尝试将目标和编译 sdk 更新为 28,但所有低于目标 sdk 的支持库都出现错误,但没有将它们更新到最新版本的选项。我尝试将构建工具更新到 28.0.2,但这也没有帮助,奇怪的是它没有提示我它落后了,我不得不手动去查看最新安装的并安装它。不确定接下来要尝试什么。什么都没有改变,它只是停止工作。下面是我的 gradle 文件。谢谢。

App gradle

    buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.2'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

repositories {
    maven { url 'https://maven.google.com' }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '28.0.2'
    defaultConfig {
        applicationId "removed"

        manifestPlaceholders = [
                onesignal_app_id               : 'removed',
                // Project number pulled from dashboard, local value is ignored.
                onesignal_google_project_number: 'REMOTE'
        ]

        minSdkVersion 19
        targetSdkVersion 27
        versionCode 50
        versionName "2.6"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.mikepenz:fontawesome-typeface:4.6.0.3@aar'
    implementation('com.mikepenz:materialdrawer:5.6.0@aar') {
        transitive = true
    }
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    implementation 'com.eminayar.panterdialog:panter-dialog:0.0.2.1'
    implementation 'com.mikhaellopez:circularprogressbar:1.1.1'
    implementation files('libs/core-3.2.1.jar')
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.afollestad:material-cab:0.1.12'
    implementation 'com.sandrios.android:sandriosCamera:1.0.8'
    implementation 'com.github.paolorotolo:appintro:4.1.0'
    implementation 'com.wdullaer:materialdatetimepicker:3.5.1'
    implementation 'com.onesignal:OneSignal:3.8.4'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-places:15.0.1'
    implementation ('com.facebook.android:facebook-android-sdk:4.33.0') {
        exclude(group: "com.google.zxing", module:"core")
    }
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'com.snapchat.kit.sdk:creative:1.0.2'
    implementation 'com.snapchat.kit.sdk:core:1.0.2'
}
apply plugin: 'com.google.gms.google-services'

Project gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.google.com" }
        maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.firebase:firebase-plugins:1.0.4'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.google.com" }
        maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

更新 Firebase 库:

    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'

并在顶级 gradle 文件中,在 repositories 下的开头添加 google():

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
 repositories {
     google()
     jcenter()
     maven { url "https://storage.googleapis.com/snap-kit-build/maven" }

  }
 dependencies {
    classpath 'com.android.tools.build:gradle:3.1.4'
    classpath 'com.google.firebase:firebase-plugins:1.0.4'
    classpath 'com.google.gms:google-services:4.0.1'
   }
}

allprojects {
   repositories {
     google()
     jcenter()
     maven { url "https://storage.googleapis.com/snap-kit-build/maven" }
  }
}

 task clean(type: Delete) {
  delete rootProject.buildDir
 }