首页 > 解决方案 > android 支持中已经存在的程序类型

问题描述

当我尝试运行应用程序时,会发生此错误:

错误:程序类型已存在:android.support.v4.os.ResultReceiver

我认为这是一个依赖问题,但我不知道如何解决。

应用级分级:

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.faisal.mychat"
    minSdkVersion 15
    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'])
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
    implementation 'com.android.support:design:26.+'
    implementation 'com.android.support:support-v4:26.+'
    implementation 'de.hdodenhof:circleimageview:2.2.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'
}

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

项目级等级:

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:3.1.1'
   }
}
    allprojects {
    repositories {
    google()
    jcenter()
   }
 }

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

标签: androidandroid-gradle-plugin

解决方案


一开始加

implementation 'com.google.firebase:firebase-core:12.0.1'

不要使用+. 请尝试对所有人使用相同且特定版本的依赖项。

例如,而不是

implementation 'com.android.support:support-v4:26.+'

利用

implementation 'com.android.support:support-v4:27.1.1'


推荐阅读