Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 图像裁剪器梯度问题_Android_Gradle_Android Gradle Plugin_Build.gradle - Fatal编程技术网

Android 图像裁剪器梯度问题

Android 图像裁剪器梯度问题,android,gradle,android-gradle-plugin,build.gradle,Android,Gradle,Android Gradle Plugin,Build.gradle,我正在使用这个库,我在一个项目中使用了它,它工作正常,现在我在另一个项目中使用它,在构建中它会引发一个错误 错误:任务“:app:transformClassesWithMultidexlistForDebug”的执行失败。 java.io.IOException:无法写入[D:\Work\TeqniaTech\Morstan Doctor\app\build\intermediates\multi-dex\debug\componentClasses.jar]无法读取[C:\Users\Abd

我正在使用这个库,我在一个项目中使用了它,它工作正常,现在我在另一个项目中使用它,在构建中它会引发一个错误

错误:任务“: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:android/support/design/widget/CoordinatorLayout$Behavior.class]

这是我的格拉德尔

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天的时间,但我找不到问题所在,有人能帮忙吗

编辑:
我认为图书馆引起了冲突,但我不知道是什么,请提供线索???

我也面临着类似的问题。但后来我发现有一个图书馆引起了这个问题

compile 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
是的。图像裁剪库。当我评论这行并在同步后运行项目时,它对我有效

现在,如何解决这个问题?我发现一些用户已经在Git链接中发布了这个问题。请浏览下面的链接,它可能会对您有所帮助

如那篇文章所述

理由 这是因为此库包含27.+版本的支持库。支持库27.1.0昨天发布,并自动包含在您的项目中,包含您自己定义的另一个版本。该库不能定义动态版本

解决方案 您应该强制所有支持库使用相同的版本

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+


我当时正面临着一些问题

dependencies {
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
}
我改成

dependencies {
api 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
}

它成功编译了

可能是@Zoe的副本,不,它是不同的,另一个甚至没有解决!OP不接受答案的情况有很多;这并不意味着问题没有解决那里的解决方案对我不起作用:我今天进来是想说对我起作用的答案,你绝对正确,那是什么t我想,当我尝试为签名的APK构建另一个应用程序时,我发现了相同的错误,然后我自己嵌入了库并修改了代码,当我看到它时,意识到不匹配的版本是问题所在,问题已经解决了,谢谢你:@AbdallahGaber很高兴帮助:
dependencies {
api 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
}