繁体   English   中英

错误:任务 ':app:dexDebug' 执行失败。

[英]Error:Execution failed for task ':app:dexDebug'.

我在 build.gradle 文件中添加了以下依赖项来实现 GCM :

 compile 'com.google.android.gms:play-services:7.8.0'

但是,得到以下错误:

Error:Execution failed for task ':app:dexDebug'.

我的 builg.gradle 文件如下:

dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])
 testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
//Dependency To hangle OKHTTP Operations
compile 'com.squareup.okhttp:okhttp:2.6.0'
//Dependency To Generate QRcode (Dependency to hangle QRcode libraries)
compile 'com.google.zxing:core:2.2'
compile 'com.embarkmobile:zxing-android-minimal:1.2.1@aar'
compile 'com.google.android.support:wearable:1.1.0'
//Dependency To hangle Scanning of QRCode
compile 'me.dm7.barcodescanner:zxing:1.8.3'
//Dependency To hangle Piccaso library
compile 'com.squareup.picasso:picasso:2.5.0'
//Multipart depency
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3') {
    exclude module: "httpclient"
}
compile 'com.android.support:cardview-v7:23.0.+'
//To make imageview round cornered
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.itextpdf:itextpdf:5.5.8'
compile 'com.google.android.gms:play-services:7.8.0'
}

查看您的项目的 gradle 文件,我认为您面临着没有由 google 强加的方法约束(即 65536)的问题。

您需要从源代码中删除不需要的库,或者您可以为您的项目创建 MultiDex 文件。

要启用 multidex 文件,请在您的 gradle 文件中进行以下更改,

 defaultConfig {
        minSdkVersion 14
        targetSdkVersion 14
        // Enabling multidex support.
        multiDexEnabled true
    }

并创建扩展应用程序的应用程序类并放置以下代码,

 @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

您可以参考以下链接以获取更多参考和信息。 http://developer.android.com/tools/building/multidex.html

希望这能帮助您解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM