Image-Cropper Gradle问题 [英] Image-Cropper Gradle issue
问题描述
我使用这个库这里,我用它在一个项目中,它工作正常,现在我在另一个项目中使用它,并在构建它会触发一个错误
$ b
错误:执行失败的任务':app:transformClassesWithMultidexlistForDebug 。
java.io.IOException:不能写[D:\Work\TeqniaTech\Mrstan-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:android / support / design / widget / CoordinatorLayout $ Behavior.class]))
这里是我的Gradle
buildscript {
存储库{
maven {url'https://maven.fabric.io/public'}
}
依赖项{
classpath'io.fabric.tools: gradle:1. +'
}
}
apply plugin:'com.android.application'
apply plugin:'io.fabric'
存储库{
maven {url'https://maven.fabric.io/public'}
}
android {
compileSdkVersion 26
buildToolsVersion26.0.2
defaultConfig {
applicationIdcom.teqnia_tech.morstan_doctor
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName0.0.1
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize4g
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}
aaptOptions {
cruncherEnabled = false
}
}
依赖项{
implementation'com.android.support。约束:约束布局:1.0.2'
编译fileTree(dir:'libs',include:['* .jar'])
编译'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'
//位置google play服务
编译'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'
//日期和时间
编译'joda-time:joda-time:2.9.9'
// network
编译'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
编译'com.facebook.android:facebook-android-sdk:4.23.+'
// for裁剪和选择图片
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'}
}
依赖项{
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 {
applicationIdcom.teqnia_tech。 morstan
minSdkVersion 17
targetSdkVersion 26
versionCode 22
versionName0.5.5
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize4g
}
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'
编译fileTree(包括:['* .jar'],dir:'libs' )
//常规
编译'com.android.support:appcompat-v7:26.0.2'
编译'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'
//测试
testCompile'junit:junit:4.12 '
testCompile'org.mockito:mockito-core:1. +'
// Twitter
compile('com.twitter.sdk.android:twitter:2.3.2@aar') {
transi tive = true;
}
//位置google play服务
编译'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;
}
//日期和时间
编译'joda-time:joda-time:2.9.9'
// rtl viewpager
//编译'klogi。 com:rtlviewpager:1.0.0'
//横幅滑块
编译'com.ss.bannerslider:bannerslider:1.8.0'
//字体转换器
//编译' uk.co.chrisjenx:书法:2.2.0'
编译'me.anwarshahriar:calligrapher:1.0'
//可搜索的微调器
//编译'com.github.MdFarhanRaja:SearchableSpinner: 1.7'
// Firebase
编译'com.google.firebase:firebase-core:11.0.1'
编译'com.google.firebase:firebase-messaging:11.0.1'
编译'com.google.firebase:firebase-database:11.0.1'
// Multidex
编译'com.android.support:multidex:1.0.1'
//可伸缩布局
编译'com.google.android:flexbox:0.3.2'
//用于过滤器增强
编译'com.jakewharton.rxbinding2:rxbinding -appcompat-V7 :2.0.0'
//用于裁剪和选择图像
编译'com.theartofdev.edmodo:android-image-cropper:2.6。+'
// AppIntro
编译'com.github.apl-devs:appintro:v4.2.0'
编译项目(':Spotlight-library')
编译项目(':rtlviewpager')
编译项目(':spinerdialog')
}
// Map
apply plugin:'com.google.gms.google-services'
我花了2天时间,找不到有什么问题,任何人都可以帮忙
编辑:
我认为这个库会引起冲突,但我不知道它是什么,请提供任何线索?
我正面临类似的问题。但后来我发现有一个库引发了这个问题。
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不能定义动态版本!
解决方案
您应该强制所有的支持库使用相同的版本。 / p>
configurations.all {
resolutionStrategy {
eachDependency {details - >
//强制所有主要支持库使用相同的版本。
if(details.requested.group =='com.android.support'
&&&details.requested.name!='multidex'
&&& detail.requested。 name!='multidex-instrumentation'){
details.useVersion supportLibraryVersion
}
}
}
}
或者,您可以将库版本从 2.6。+
降级为 2.5。 +
compile'com.theartofdev.edmodo:android-image-cropper:2.5。+'
I am using this library here and I used it in a project and it works fine now I am using it in another project and in build it fires an error
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [D:\Work\TeqniaTech\Morstan-Doctor\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\AbdallahGaber.gradle\caches\transforms-1\files-1.1\support-core-ui-27.1.0.aar\d05e3ddb1fe5f53fdf878524820d2b3c\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
and here is my 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'
and For the project that worked that is the 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'
I spent 2 days and I can't find what is the problem , can anyone help
Edit: I think the library cause conflict but I can't know what is it, any clue please??
I was facing similar problem. But later on I found out that there is one library which is causing that issue.
compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
Yes. Image Cropping library. When I commented that line and run project after sync, it worked for me.
Now, how to solve that thing? I have found out that some users already posted this issue in Git Link. Please go through below link, it might help you.
https://github.com/ArthurHub/Android-Image-Cropper/issues/495
As Described in that post.
Reason This is due to the fact that this library includes support libraries with 27.+ version. Support library 27.1.0 was released yesterday and is automatically included in your project with another version defined by yourself. The lib must not define dynamic version!
Solution You should force all of your support libraries to use the same version.
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
}
}
}
}
or, You can downgrade library version from 2.6.+
to 2.5.+
compile 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
这篇关于Image-Cropper Gradle问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!