我一直在处理我的应用程序,直到添加implementation 'info.androidhive:barcode-reader:1.1.5'
我的应用程序开始因以下错误而无法构建:
Duplicate class android.support.design.widget.CoordinatorLayout found in
modules classes.jar (com.android.support:coordinatorlayout:28.0.0) and
classes.jar (com.android.support:design:27.0.0)
Duplicate class android.support.design.widget.CoordinatorLayout$1 found in
modules classes.jar (com.android.support:coordinatorlayout:28.0.0) and
classes.jar (com.android.support:design:27.0.0)
Duplicate class android.support.design.widget.CoordinatorLayout$Behavior
found in modules classes.jar (com.android.support:coordinatorlayout:28.0.0)
and classes.jar (com.android.support:design:27.0.0)
Duplicate class
android.support.design.widget.CoordinatorLayout$DefaultBehavior found in
modules classes.jar (com.android.support:coordinatorlayout:28.0.0) and
classes.jar (com.android.support:design:27.0.0)
Duplicate class
android.support.design.widget.CoordinatorLayout$DispatchChangeEvent found in
modules classes.jar (com.android.support:coordinatorlayout:28.0.0) and
classes.jar (com.android.support:design:27.0.0)
Duplicate class
android.support.design.widget.CoordinatorLayout$HierarchyChangeListener
found in modules classes.jar (com.android.support:coordinatorlayout:28.0.0)
and classes.jar (com.android.support:design:27.0.0)
Duplicate class android.support.design.widget.CoordinatorLayout$LayoutParams
found in modules classes.jar (com.android.support:coordinatorlayout:28.0.0)
and classes.jar (com.android.support:design:27.0.0)
Duplicate class
android.support.design.widget.CoordinatorLayout$OnPreDrawListener found in
modules classes.jar (com.android.support:coordinatorlayout:28.0.0) and
classes.jar (com.android.support:design:27.0.0)
Duplicate class android.support.design.widget.CoordinatorLayout$SavedState
found in modules classes.jar (com.android.support:coordinatorlayout:28.0.0)
and classes.jar (com.android.support:design:27.0.0)
Duplicate class android.support.design.widget.CoordinatorLayout$SavedState$1
found in modules classes.jar (com.android.support:coordinatorlayout:28.0.0)
and classes.jar (com.android.support:design:27.0.0)
Duplicate class
android.support.design.widget.CoordinatorLayout$ViewElevationComparator
found in modules classes.jar (com.android.support:coordinatorlayout:28.0.0)
and classes.jar (com.android.support:design:27.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
当然,转到文档链接不会带我到任何地方。
这也是我的gradle依赖项:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.jakewharton:butterknife:9.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.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'
implementation 'com.google.android.gms:play-services-vision:17.0.2'
implementation 'org.jetbrains:annotations-java5:15.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation `'info.androidhive:barcode-reader:1.1.5'`
}
当我删除'info.androidhive:barcode-reader:1.1.5'
依赖项时,它会正常运行(但我需要它)。
我不知道要删除什么或该怎么做,任何提示都是值得的。
答案 0 :(得分:0)
当我明确添加此依赖项时,问题已解决:
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
答案 1 :(得分:0)
由于传递依赖,您具有相同工件的两个版本。
从com.android.support
工件中排除barcode-reader
组。
implementation ('info.androidhive:barcode-reader:1.1.5'){
exclude group: "com.android.support"
}