我在构建项目时遇到以下错误.在这个项目中没有使用协调布局.只是在构建中作为依赖项添加.格雷德尔:

我使用的是Android Studio3.2金丝雀4.

LogCat

agpbi:{"Kind":"Error","Text":"程序类型已存在:android.support.design.widget.CoordinatorLayout$Behavior","Sources":[{}],"Tool":"D8"} :app:transformDexArchiveWithExternalLibsDexMergerForDebug失败 失败:生成失败,出现异常. *哪里出了问题: 任务‘:app:transformDexArchiveWithExternalLibsDexMergerForDebug’.执行失败

通用域名格式.安卓建设者德兴.DexArchiveMergerException:合并dex存档时出错:/windows/Other/app/build/intermediates/transforms/dexBuilder/debug/0.jar、/windows/Other/app/build/intermediates/transforms/dexBuilder/debug/1.jar、/windows/Other/app/build/intermediates/transforms/dexBuilder/debug/4.罐子

/windows/Other/app/build/intermediates/transforms/dexBuilder/debug/294.jar

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

build.gradle

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "com.dagkot"
        minSdkVersion 16
        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'
            buildConfigField "String", "BASE_URL", "\"http://api.openweathermap.org/data/2.5/\""
            buildConfigField "String", "API_KEY", "\"435e9075f348868c2714fe7c6895efa5\""
        }
        debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        buildConfigField "String", "BASE_URL", "\"http://api.openweathermap.org/data/2.5/\""
        buildConfigField "String", "API_KEY", "\"xxxx\""
    }
}
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"


    // Dagger dependencies
    compileOnly 'org.glassfish:javax.annotation:10.0-b28'
    implementation "com.google.dagger:dagger:$rootProject.daggerVersion"
    implementation "com.google.dagger:dagger-android:$rootProject.daggerVersion"
    implementation "com.google.dagger:dagger-android-support:$rootProject.daggerVersion"
    kapt "com.google.dagger:dagger-android-processor:$rootProject.daggerVersion"
    kapt "com.google.dagger:dagger-compiler:$rootProject.daggerVersion"

    //Butterknife dependencies
    implementation 'com.jakewharton:butterknife:8.8.1'
    kapt 'com.jakewharton:butterknife-compiler:8.8.1'

    // Architecture Components Dependencies
    kapt "android.arch.lifecycle:compiler:$rootProject.lifeCycle"
    implementation "android.arch.lifecycle:extensions:$rootProject.lifeCycle"
    implementation "android.arch.lifecycle:reactivestreams:$rootProject.lifeCycle"
    implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"

    // Retrofit/RxJava Dependencies
    implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion"
    implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion"
    implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rxAndroidVersion"
    implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
    implementation 'com.jakewharton.rxbinding2:rxbinding-kotlin:2.1.1'

    // GSON
    implementation "com.google.code.gson:gson:$rootProject.gsonVersion"

    // Rx Location Manager
    implementation 'io.nlopez.smartlocation:library:3.3.3'
    implementation 'io.nlopez.smartlocation:rx:3.3.1'

    //Anko Dependencies
    implementation "org.jetbrains.anko:anko-commons:$rootProject.anko_version"
    implementation "org.jetbrains.anko:anko-design:$rootProject.anko_version"
    implementation 'com.android.support:design:27.0.2'

    implementation("com.github.hotchemi:permissionsdispatcher:3.1.0") {
        // if you don't use android.app.Fragment you can exclude support for them
        exclude module: "support-v13"
    }
    kapt "com.github.hotchemi:permissionsdispatcher-processor:3.1.0"
}

推荐答案

当我将支持度降低到appcompat级时,它起到了作用,如下所示:

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

以前是

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

OR

这一点也可以通过adding support design dependency修正

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

Android相关问答推荐

请求标头为空/无法通过拦截器获取

在Jetpack Compose中从LazyColumn中删除项目时发生IndexOutOf边界异常

Android手柄注射周期错误,多个模块引用一个核心模块

Compose 状态不是 recomposing

如何将可重用的 ExtendedFloatingActionButton 与可重用的脚手架链接起来

Android:ActivityCompat.requestPermissions 不显示弹窗(Android 13,targetSdkVersion=33)

获取 ArithmeticException:除以零,但我没有在任何地方除以零

在事件中使用 Context/Toast 时不需要的重组 - Jetpack Compose

Jetpack Compose UI - 在 AlertDialog 中单击时按钮宽度会发生变化

如何在jetpack compose中通过lamda返回columnScope/RowScope

为片段设置主题

LazyColumn 单选中的状态提升. Jetpack compose

如何在屏幕旋转或系统主题更改后将光标移动到 TextField 的末尾并保持键盘显示?

在 Kotlin 中循环遍历字符串并用新行替换句号

有人可以向我解释这两个结果有什么区别吗?

MVVM - 这个逻辑的最佳层是什么?

WearOS - 有没有办法从心电图传感器收集原始数据?

如何将私有 mutableStateOf 分配给 Android Jetpack 中的 State 变量?

已弃用的 ManagedQuery() 问题

用于 ldpi、mdpi、hdpi、xhdpi 显示器的 android 初始屏幕尺寸? - 例如:ldpi 为 1024X768 像素