有什么办法解决重复的类错误?

时间:2019-06-08 23:00:04

标签: java android xml gradle

我正在尝试将Google Places集成到我的android应用程序中,但是 提示错误信息

“错误:程序类型已存在:  com.google.android.gms.location.places.zza”

我尝试删除此依赖项:

“实现'com.google.android.gms:play -services:11.8.0'“

我已经在使用这个了,

“实现'com.google.android.libraries.places:places:1.1.0'”

这样做可以消除我的错误,但我的应用在加载时崩溃。

我的gradle(Module:app)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 28
    defaultConfig {
        multiDexEnabled true
        applicationId "com.example.fyphonin"
        minSdkVersion 20
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    implementation 'com.android.support:customtabs:28.0.0-alpha1'
    implementation 'com.android.support:support-vector-drawable:28.0.0-alpha1'
    implementation 'com.android.support:support-media-compat:28.0.0-alpha1'
    implementation 'com.android.support:support-v4:28.0.0-alpha1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'

    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'

    // Add libraries
    implementation 'com.github.glomadrian:MaterialAnimatedSwitch:1.1@aar'
    implementation 'com.firebase:geofire-android:2.1.2'
    implementation 'com.github.d-max:spots-dialog:0.7@aar'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation 'com.google.android.gms:play-services-auth:11.8.0'
    implementation 'com.google.android.gms:play-services-maps:11.8.0'
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.google.android.libraries.places:places:1.1.0'
    implementation 'com.karumi:dexter:5.0.0'
    implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
}
apply plugin: 'com.google.gms.google-services'

我的gradle(项目):

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.google.com'
        }
        maven {
            url 'https://dl.bintray.com/glomadrian/maven'
        }
    }
}

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

0 个答案:

没有答案