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

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

  •  0
  • Michael  · 技术社区  · 6 年前

    我的项目昨天进展顺利。我今天打开它,发现这个错误:

    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

        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'
    

    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
    }
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   Peter Haddad    6 年前

    更新firebase库:

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

    在顶级梯度文件中,添加 google() repositories :

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