Java 错误生成APK错误:任务执行失败';:应用程序:transformClassesWithDexForRelease';
错误球APK 这个代码有什么问题?火基?我试着清理和重建。但我有这个错误 错误:任务“:app:transformClassesWithJarMergingForDebug”的执行失败。 com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:javax/inject/inject.class 我的应用程序渐变文件:Java 错误生成APK错误:任务执行失败';:应用程序:transformClassesWithDexForRelease';,java,android,gradle,Java,Android,Gradle,错误球APK 这个代码有什么问题?火基?我试着清理和重建。但我有这个错误 错误:任务“:app:transformClassesWithJarMergingForDebug”的执行失败。 com.android.build.api.transform.TransformException:java.util.zip.zipeException:重复条目:javax/inject/inject.class 我的应用程序渐变文件: apply plugin: 'com.android.applica
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' }
}
}
我需要做什么?这曾经发生在我身上,问题是
重复条目: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'
Maven的问题。
Maven不能包含在Gradle中。我不包含目录库。你的
库的内容是什么?我可以在文件夹中包含两个库。idea javax_inject_1.xml和javax_inject_2_5_0_b32.xml。也许是错误?但是我不知道这个库生成了什么是的,就是这样,删除其中一个。如果我删除了其中一个,那么我重新生成项目xml文件create again您是否尝试过使缓存无效并重新启动,然后清理并重新生成?我试过了。这是毫无帮助的