我遇到了这个问题:当我在Android Studio上运行我的项目时工作正常,但是当我尝试构建APK时(在BUILD> BUILD Apk(s)上)它会显示下一个错误:
错误:任务':app:transformClassesWithMultidexlistForDebug'的执行失败。 java.io.IOException:无法写入[/Users/sergio/Documents/ink/touch_android/app/build/intermediates/multi-dex/debug/componentClasses.jar](无法读取[/ Users / sergio /。 gradle这个/高速缓存/模块-2 /文件-2.1 / com.fasterxml.jackson.core /杰克逊-数据绑定/ 2.3.3 / 63b77400b5f1cf83a81823562c48d3120ef5518e /杰克逊-数据绑定-2.3.3.jar(;;;;;; **。类)](重复的zip条目[jackson-databind-2.3.3.jar:com / fasterxml / jackson / databind / JsonDeserializer $ None.class]))
据我所知,这是由我在项目中找到的名为JsonDeserializer的重复类引起的
但我无法找到一种方法从列出的每个jar中“取消链接”这些文件。这是我的gradle文件。
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "---"
minSdkVersion 19
targetSdkVersion 23
versionCode -
versionName "-"
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
multiDexEnabled true
ndk {
abiFilters "x86", "armeabi-v7a", "armeabi"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { resources.srcDirs = ['src/main/resources', 'src/main/java/includes'] } }
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies
{
//compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
implementation files('libs/gson-2.5.jar')
implementation files('libs/guava-18.0.jar')
implementation files('libs/snmp6_1.jar')
implementation 'com.crittercism:crittercism-android-agent:5.6.4'
implementation files('libs/jackson-annotations-2.2.3.jar')
implementation files('libs/jackson-databind-2.2.3.jar')
implementation files('libs/httpmime-4.3.2.jar')
implementation files('libs/httpcore-4.3.1.jar')
implementation files('libs/commons-lang3-3.4.jar')
implementation files('libs/commons-validator-1.4.0.jar')
implementation files('libs/jackson-core-2.2.3.jar')
implementation files('libs/commons-net-3.1.jar')
implementation files('libs/ZSDK_ANDROID_API.jar')
implementation files('libs/opencsv-2.2.jar')
implementation files('libs/commons-io-2.2.jar')
implementation files('libs/mrzjniInterfaceJar.jar')
implementation 'com.kyleduo.switchbutton:library:1.4.1'
implementation 'com.github.nkzawa:socket.io-client:0.3.0'
implementation 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
implementation 'com.android.support:multidex:1.0.1'
implementation('de.keyboardsurfer.android.widget:crouton:1.8.5@aar')
implementation 'com.android.support:appcompat-v7:23.4.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:23.4.0'
implementation files('libs/cw-deviceapi20171026.jar')
implementation 'org.jmrtd:jmrtd:0.5.5'
implementation 'net.sf.scuba:scuba-sc-android:0.0.9'
implementation 'com.madgag.spongycastle:prov:1.54.0.0'
implementation 'edu.ucar:jj2000:5.2'
implementation 'com.github.mhshams:jnbis:1.1.0'
implementation files('libs/BrotherPrintLibrary.jar')
implementation files('libs/MobilePrintLib.jar')
}
答案 0 :(得分:1)
在要添加jackson依赖项的模块中,排除已在其他lib中的类。否则,将其从其他lib中排除并留在杰克逊上。
答案 1 :(得分:1)
尝试删除此implementation
implementation files('libs/jackson-core-2.2.3.jar')
并做
Build > Clean Project