我正在使用这个库here并且我在一个项目中使用它并且它工作正常我现在在另一个项目中使用它并且在构建中它会触发错误
错误:任务':app:transformClassesWithMultidexlistForDebug'的执行失败。 java.io.IOException:无法写[D:\ Work \ TeqniaTech \ Morstan-Doctor \ app \ build \ intermediates \ multi-dex \ debug \ componentClasses.jar](无法读取[C:\ Users \ AbdallahGaber .gradle \ caches \ transforms-1 \ files-1.1 \ support-core-ui-27.1.0.aar \ d05e3ddb1fe5f53fdf878524820d2b3c \ jars \ classes.jar(;;;;;; **。class)](重复的zip条目[ classes.jar:机器人/支持/设计/插件/ CoordinatorLayout $ Behavior.class]))
这是我的Gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.teqnia_tech.morstan_doctor"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "0.0.1"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-v4:26.0.2'
//location google play service
compile 'com.google.android.gms:play-services-location:11.0.1'
//picasso
compile 'com.squareup.picasso:picasso:2.5.2'
//Twitter
compile 'com.twitter.sdk.android:twitter:3.1.1'
//Timber
compile 'com.jakewharton.timber:timber:4.1.0'
//Butterknife
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.jakewharton:butterknife:8.8.1'
//Date and time
compile 'joda-time:joda-time:2.9.9'
// network
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:+'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
//Twitter
compile('com.twitter.sdk.android:twitter:2.3.2@aar') {
transitive = true;
}
//Facebook SDK
compile 'com.facebook.android:facebook-android-sdk:4.23.+'
// for cropping and selecting image
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
//Firebase
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
//Multidex
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true;
}
}
//Map
apply plugin: 'com.google.gms.google-services'
并且对于那个有效的项目是Gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply from: "${project.rootDir}/QA/quality.gradle"
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.teqnia_tech.morstan"
minSdkVersion 17
targetSdkVersion 26
versionCode 22
versionName "0.5.5"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
// general
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:mediarouter-v7:26.0.2'
compile 'com.android.support:customtabs:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:support-v4:26.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services:11.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.jakewharton:butterknife:8.8.1'
compile 'com.jakewharton.timber:timber:4.1.0'
// inspection
compile 'com.facebook.stetho:stetho:1.3.0'
compile 'com.facebook.stetho:stetho-okhttp3:1.3.0'
//Facebook SDK
compile 'com.facebook.android:facebook-android-sdk:4.23.+'
// network
compile 'com.squareup.retrofit2:retrofit:2.0.0'
compile 'com.squareup.retrofit2:converter-gson:+'
compile 'com.squareup.okhttp3:logging-interceptor:3.0.1'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
// tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.+'
//Twitter
compile('com.twitter.sdk.android:twitter:2.3.2@aar') {
transitive = true;
}
//location google play service
compile 'com.google.android.gms:play-services-location:11.0.1'
//picasso and rounded image
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:2.3.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
//Date and time
compile 'joda-time:joda-time:2.9.9'
//rtl viewpager
// compile 'klogi.com:rtlviewpager:1.0.0'
//Banner slider
compile 'com.ss.bannerslider:bannerslider:1.8.0'
//font changer
// compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'me.anwarshahriar:calligrapher:1.0'
//Searchable spinner
// compile 'com.github.MdFarhanRaja:SearchableSpinner:1.7'
//Firebase
compile 'com.google.firebase:firebase-core:11.0.1'
compile 'com.google.firebase:firebase-messaging:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
//Multidex
compile 'com.android.support:multidex:1.0.1'
//flexable layout
compile 'com.google.android:flexbox:0.3.2'
// for filter enhancing
compile 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
// for cropping and selecting image
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
//AppIntro
compile 'com.github.apl-devs:appintro:v4.2.0'
compile project(':Spotlight-library')
compile project(':rtlviewpager')
compile project(':spinerdialog')
}
//Map
apply plugin: 'com.google.gms.google-services'
我花了2天时间找不到问题,任何人都可以帮忙
编辑: 我认为图书馆会引起冲突,但我不知道它是什么,请问任何线索?
答案 0 :(得分:1)
我遇到了类似的问题。但后来我发现有一个库导致了这个问题。
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
是。图像裁剪库。当我在同步后评论该行并运行项目时,它对我有用。
现在,如何解决这个问题?我发现有些用户已经在Git Link中发布了这个问题。请通过以下链接,它可能会帮助你。
https://github.com/ArthurHub/Android-Image-Cropper/issues/495
如该帖所述。
<强>原因强> 这是因为该库包含27. +版本的支持库。昨天发布了支持库27.1.0,它自动包含在您自己定义的另一个版本的项目中。 lib不能定义动态版本!
<强>解决方案强> 您应该强制所有支持库使用相同的版本。
configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force all of the primary support libraries to use the same version.
if (details.requested.group == 'com.android.support'
&& details.requested.name != 'multidex'
&& details.requested.name != 'multidex-instrumentation') {
details.useVersion supportLibraryVersion
}
}
}
}
或者,您可以将库版本从2.6.+
降级为2.5.+
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
答案 1 :(得分:0)
我遇到了
问题dependencies {
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
}
我更改为
dependencies {
api 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
}
编译成功