错误程序类型已存在:android.support.design.widget.CoordinatorLayout $ Behavior

时间:2018-07-06 07:07:29

标签: java android

此行显示

时出错

所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到版本27.1.1、26.1.0。示例包括com.android.support:animated-vector-drawable:27.1.1和com.android.support:customtabs:26.1.0

implementation 'com.android.support:appcompat-v7:26.1.0'

是我的

app.gradle

apply plugin: 'com.android.application'


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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:customtabs:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    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.firebase:firebase-core:16.0.0'
    implementation 'com.google.android.gms:play-services-location:9.2.0'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:10.2.1'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
}
apply plugin: 'com.google.gms.google-services'

3 个答案:

答案 0 :(得分:2)

出现此错误是因为您可以使用旧版本,因此只需更新版本依赖项即可。

更改:

compileSdkVersion 26targetSdkVersion 26

compileSdkVersion 27targetSdkVersion 27

也要更改:

implementation 'com.android.support:appcompat-v7:27.1.1'

implementation 'com.android.support:customtabs:27.1.1'

implementation 'com.android.support:design:27.1.1'

Sync.. Clean & ReBuild

答案 1 :(得分:1)

我通过简单地更改

来解决此问题

实现'com.android.support:design:26.1.0'

收件人

implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'

我希望这会有所帮助...也进行gradle更新 专门用于响应本机导航v2

答案 2 :(得分:0)

apply plugin: 'com.android.application'


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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    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.firebase:firebase-core:16.0.0'
    implementation 'com.google.android.gms:play-services-location:9.2.0'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:10.2.1'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
}
apply plugin: 'com.google.gms.google-services'