Ошибка: тип программы уже существует: com.google.firebase.analytics.FirebaseAnalytics $ Event - PullRequest
0 голосов
/ 10 апреля 2019

Ошибка сохраняется, когда я пытаюсь построить свой код. Я уже предоставил последние версии для всех реализаций. Также я не использовал инструмент аналитики firebase, но почему происходит эта ошибка?

Я обновлял версии реализаций одну за другой, чтобы уменьшить количество ошибок такого рода.

мой app/build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.ayushadarsh.odolog"
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    //implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    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'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    implementation 'com.google.firebase:firebase-core:16.0.8'
    implementation 'com.google.firebase:firebase-auth:16.2.1'

    //noinspection UseOfBundledGooglePlayServices
    implementation "com.google.android.gms:play-services:12.0.1"
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
    implementation 'com.google.firebase:firebase-ml-vision:19.0.3'
}
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Ответы [ 2 ]

1 голос
/ 10 апреля 2019

Это необходимо изменить / обновить до play-services-base:16.1.0 (который не входит в комплект):

//noinspection UseOfBundledGooglePlayServices
implementation "com.google.android.gms:play-services:12.0.1"

И удали эту строку; просто потому, что рисование проблемы не решает проблему:

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

Библиотеки com.android.support:appcompat-v7:28.0.0 & com.android.support:cardview-v7:28.0.0 также добавляются дважды. и этот плагин принадлежит нижней части build.gradle:

apply plugin: "com.google.gms.google-services"

... это исправляет сборку:

dependencies {

    implementation "com.android.support:appcompat-v7:28.0.0"
    implementation "com.android.support:support-v4:28.0.0"
    implementation "com.android.support:cardview-v7:28.0.0"
    implementation "com.android.support:recyclerview-v7:28.0.0"
    implementation "com.android.support:exifinterface:28.0.0"
    implementation "com.android.support:design:28.0.0"
    implementation "com.android.support.constraint:constraint-layout:1.1.3"

    implementation "com.google.firebase:firebase-core:16.0.8"
    implementation "com.google.firebase:firebase-auth:16.2.1"
    implementation "com.google.firebase:firebase-database:16.1.0"
    implementation "com.google.firebase:firebase-ml-vision:19.0.3"

    implementation ("com.google.android.gms:play-services-base:16.1.0") {
        exclude group: "com.android.support", module: "support-v4"
    }
    implementation ("com.google.android.gms:play-services-auth:16.0.1") {
        exclude group: "com.android.support", module: "support-v4"
    }
    implementation ("com.theartofdev.edmodo:android-image-cropper:2.6.0") {
        exclude group: "com.android.support", module: " exifinterface"
    }

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

apply plugin: "com.google.gms.google-services"
0 голосов
/ 17 мая 2019

Удалить это

implementation 'com.google.android.gms:play-services:12.0.1'

изменить

com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

до

apply plugin: 'com.google.gms.google-services'
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...