当我尝试运行应用程序时出现此错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException:
duplicate entry: android/support/v4/print/PrintHelper$PrintHelperStubImpl.class
Manifest包含此部分:
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19"
tools:ignore="OldTargetApi"
tools:overrideLibrary="android.support.test.espresso,
android.support.v7.appcompat,
android.support.mediacompat,
android.support.v4,
android.support.fragment,
android.support.coreui,
android.support.coreutils,
android.support.graphics.drawable,
android.support.compat">
</uses-sdk>
这些是gradle中的依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
// })
compile 'com.android.support:appcompat-v7:26.+'
testCompile 'junit:junit:4.12'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}
任何想法我需要做什么?
我是Android开发的新手,所以请假设我一无所知......
答案 0 :(得分:1)
我曾经遇到过同样的问题,就像appcompat-v7包括support-v4一样,所以它创建了重复的条目。
我通过从中排除v4支持库来解决这个问题:
compile ('com.android.support:appcompat-v7:26.+') {
exclude module: 'support-v4'
}