gpt4 book ai didi

java - 错误构建 APK 错误 :Execution failed for task ':app:transformClassesWithDexForRelease'

转载 作者:行者123 更新时间:2023-11-29 02:37:44 27 4
gpt4 key购买 nike

错误构建 APK这段代码有什么问题?火力基地?我尝试清理并重建。但是我有这个错误。

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: 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' }
}
}

我需要做什么?

最佳答案

我遇到过一次,具体问题是

重复条目: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'

关于java - 错误构建 APK 错误 :Execution failed for task ':app:transformClassesWithDexForRelease' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46084520/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com