【问题标题】:error after adding library 'com.ramimartin.bluetooth:AndroidBluetoothLibrary:1.0.1-SNAPSHOT'添加库 'com.ramimartin.bluetooth:AndroidBluetoothLibrary:1.0.1-SNAPSHOT' 后出错
【发布时间】:2016-06-06 08:20:18
【问题描述】:

我已经添加了这个库,但是当我想构建项目进行调试时,它会显示如下错误

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException:java.util.zip.ZipException: duplicate entry: android/support/v4/util/DebugUtils.class

我什么都试过了

multiDexEnabled true

dexOptions {
    javaMaxHeapSize "3g" //specify the heap size for the dex process
}

exclude group: 'com.android.support', module: 'support-v4'

但对我不起作用。

这是我的 build.gradle 文件依赖项

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile ('com.journeyapps:zxing-android-embedded:3.2.0@aar') {
        exclude group: 'com.android.support', module: 'support-v4'
}
compile ('com.google.zxing:core:3.2.1'){
    exclude group: 'com.android.support', module: 'support-v4'
}
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile ('com.ramimartin.bluetooth:AndroidBluetoothLibrary:1.0.1-SNAPSHOT') {
    exclude group: 'com.android.support', module: 'support-v4'
}
}

感谢您的所有建议。

【问题讨论】:

    标签: android build bluetooth dependencies android-support-library


    【解决方案1】:

    等级 默认配置 { ... minSdkVersion 14 targetSdkVersion 21 ...

            // Enabling multidex support.
            multiDexEnabled true
        }
    dependencies {
      compile 'com.android.support:multidex:1.0.0'
    }
    

    清单

        <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.android.multidex.myapplication">
        <application
            ...
            android:name="android.support.multidex.MultiDexApplication">
            ...
        </application>
    </manifest>
    

    但是我有这个错误 错误:任务 ':app:transformClassesWithJarMergingForDebug' 执行失败。

    com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android/support/v4/util/DebugUtils.class

    取自 Error:Execution failed for task ':app:transformClassesWithDexForDebug'

    【讨论】:

      猜你喜欢
      • 2015-02-16
      • 1970-01-01
      • 2016-01-30
      • 1970-01-01
      • 2021-09-14
      • 2020-12-16
      • 2020-04-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多