错误:任务':app:transformClassesWithDexForRelease'的执行失败 - Android工作室 [英] Error:Execution failed for task ':app:transformClassesWithDexForRelease' - Android studio

查看:4554
本文介绍了错误:任务':app:transformClassesWithDexForRelease'的执行失败 - Android工作室的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功地创建了一个使用android studio的android应用程序,当我运行到android模拟器或连接到开发机器的设备时工作正常,但是当我尝试从build / outputs / apk安装apk时,应用程序崩溃。也试图从生成生成签署的apk从生成 - >生成签名的apk(包括发布和调试),但它没有生成与以下错误的apk:

I have successfully created an android application using android studio, and works fine when i run into android emulator or device connected to the development machine, but when i try to install the apk from build/outputs/apk the application crashes on opening.Also i tried to generate signed apk from android studio from build -> Generate signed apk (both release and debug) but it fails to generate the apk with the following error:

Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/Identifier;

我的 build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.aitrich.android.modern.photo"
        minSdkVersion 14
        targetSdkVersion 25
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}


apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'org.greenrobot.greendao'

ext {
    supportLibraryVersion = '25.0.1'
    playServicesVersion = '9.0.2'
    retrofitVersion = '2.1.0'
}

greendao {
    schemaVersion 1
}

apt {
    arguments {
        stagGeneratedPackageName "com.aitrich.android.modern.stag.generated"
        stagDebug true
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    testCompile 'junit:junit:4.12'

    compile "com.android.support:design:$supportLibraryVersion"
    compile "com.android.support:support-v13:$supportLibraryVersion"
    compile "com.android.support:cardview-v7:$supportLibraryVersion"
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'org.greenrobot:greendao:3.2.0'
    compile 'com.jakewharton:butterknife:8.4.0'
    compile 'com.intuit.sdp:sdp-android:1.0.3'
    compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
    compile 'com.mobsandgeeks:android-saripaar:2.0.3'
    compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
    compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.vimeo.stag:stag-library:2.0.2'
    compile 'com.github.hotchemi:permissionsdispatcher:2.2.0'
    compile 'com.tapadoo.android:alerter:1.0.6'
    compile 'ch.halcyon:squareprogressbar:1.6.0'
    compile 'com.yalantis:ucrop:2.2.0'
    compile 'com.yalantis:ucrop:2.2.0-native'
    compile 'com.evernote:android-job:1.1.8'
    compile('com.github.silvestrpredko:dot-progress-bar:1.1') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }
    compile('com.github.StevenDXC:DxLoadingButton:1.5') {
        exclude group: 'com.android.support', module: 'appcompat-v7'
    }
    compile('com.redmadrobot:chronos:1.0.7') {
        exclude module: 'eventbus:2.4.0'
    }
    compile ('co.infinum:materialdatetimepicker-support:3.1.3') {
        exclude group: 'com.android.support', module: 'design'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude group: 'com.android.support', module: 'support-v13'
    }
    compile 'com.android.support:multidex:1.0.1'


    apt 'com.jakewharton:butterknife-compiler:8.4.0'
    apt 'com.vimeo.stag:stag-library-compiler:2.0.2'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.2.0'
}


推荐答案

编辑:

请检查您是否拥有这两个库:

Please check you having this two libraries common :

 compile 'com.yalantis:ucrop:2.2.0'
 compile 'com.yalantis:ucrop:2.2.0-native'

删除其中一个,并检查您需要哪一个。

remove one of them and check which one is needed for you.

检查 这个答案为multidex problem.that帮助我解决这个问题。

Check this answer for multidex issue.that one helped me to fix that issue.

看来你的logcat清楚地显示注释标识符 DexException:多个dex文件定义Lorg / intellij / lang / annotations / Identifier 。您应该删除此行支持-annotations:

It seems your logcat clearly shows annotations identifier DexException: Multiple dex files define Lorg/intellij/lang/annotations/Identifier. You should remove this line support -annotations:

 androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

此外,如果您使用的是如下的google play服务包: compile'c​​om.google.android.gms:play-services:8.1.0

Moreover, If you are using google play services bundle like this : compile 'com.google.android.gms:play-services:8.1.0

单独变成gms对于所有图书馆

change into below gms separately for all libraries

compile 'com.google.android.gms:play-services-location:8.1.0'
 compile 'com.google.android.gms:play-services-base:8.1.0'
 compile 'com.google.android.gms:play-services-analytics:8.1.0'
 compile 'com.google.android.gms:play-services-maps:8.1.0'

 compile "com.google.android.gms:play-services-gcm:8.1.0'    //

用于gcm推送通知

这篇关于错误:任务':app:transformClassesWithDexForRelease'的执行失败 - Android工作室的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆