错误Bulid APK 这段代码有什么问题?火力地堡?我尝试清理和重建。但我有这个错误。
错误:任务':app:transformClassesWithJarMergingForDebug'的执行失败。 com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:javax / inject / Inject.class
我的应用程序gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "myapp.over.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
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.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'me.anwarshahriar:calligrapher:1.0'
compile 'com.github.mvpotter:kladr-api-client:0.6.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
我需要做什么?
答案 0 :(得分:0)
这件事发生在我身上,具体问题是
duplicate entry: javax/inject/Inject.class
所以我检查了我的依赖项,发现我有多个依赖项声明,所以进入你的libs文件夹并检查是否有一个jar文件也在你的依赖项中声明
compile fileTree(include: ['*.jar'], dir: 'libs')
其中很可能其中一个已经在您的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.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'me.anwarshahriar:calligrapher:1.0'
compile 'com.github.mvpotter:kladr-api-client:0.6.1'
compile 'com.google.firebase:firebase-storage:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
答案 1 :(得分:0)
Maven中的问题。 Maven不能包含在Gradle中。