错误:执行失败的任务“:应用程序:dexDebug”。完成非零值2与Facebook壁画 [英] Error:Execution failed for task ':app:dexDebug'. finished with non-zero exit value 2 with Facebook Fresco

查看:162
本文介绍了错误:执行失败的任务“:应用程序:dexDebug”。完成非零值2与Facebook壁画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读过这里对这个问题的每一个线程,我找不到任何答案,我的问题。

添加壁画的lib之后我建立我的应用程序时收到此错误。 该问题的行是:编译com.facebook.fresco:壁画:0.5.3 + 错误:

  

错误:未能执行任务:应用程序:dexDebug

。      
    

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程命令     C:\ Program Files文件\的Java \ jdk1.7.0_71 \斌\ java.exe的''与完成     非零值2

  

如果我走壁画编译行了,它的工作原理。

我的摇篮看起来是这样的:

  buildscript {
    库{
        mavenCentral()
        行家{URLhttps://oss.sonatype.org/content/repositories/snapshots'}
    }
    依赖{
        类路径com.android.tools.build:gradle:1.2.3
        //类路径org.robolectric:robolectric-摇篮 - 插件:1.1.0
    }
}

allprojects {
    库{
        mavenCentral()
        行家{URLhttps://oss.sonatype.org/content/repositories/snapshots'}
    }
}

应用插件:com.android.application
//应用插件:org.robolectric

安卓{
    compileSdkVersion 22
    buildToolsVersion22.0.1
    defaultConfig {
        的applicationIDcom.maddogs.mymoney
        的minSdkVersion 11
        targetSdkVersion 22
        // testInstrumentationRunnercom.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner
    }
    sourceSets {
        androidTest {
            setRoot(SRC /测试)//注意,这是androidTest而不是instrumentTest
        }
    }

    productFlavors {
    }

    lintOptions {
        abortOnError假
    }
}

依赖{

    编译com.facebook.fresco:壁画:0.5.3+
    编译com.facebook.android:facebook-android-sdk:4.3.0

    编译com.facebook.stetho:stetho:1.1.1
    编译com.android.support:appcompat-v7:22.2.0
    编译de.greenrobot:eventbus:2.4.0
    编译com.google.android.gms:播放服务:7.5.0
    编译com.jakewharton:butterknife:6.1.0
    编译com.android.support:support-v4:22.2.0
    编译com.android.support:recyclerview-v7:22.2.0
    编译com.android.support:cardview-v7:22.2.0
    编译com.android.support:design:22.2.0
    编译com.nostra13.universalimageloader:通用图像装载机:1.9.4
    编译com.bignerdranch.android:recyclerview-multiselect:+
    编译文件(库/解析-1.9.2.jar)
    编译文件(库/ ParseCrashReporting-1.9.2.jar)
    编译文件(库/ ParseFacebookUtilsV4-1.9.2.jar)
}
 

在此先感谢!

解决方案

有时候应用程序:当库被多次包含在你的项目dexDebug 错误显示。当不使用你的应用程序的任何依赖相关的错误,那么它可能是65K的方法限制的问题。在Dalvik可执行的规范限制的方法的总数,你可以阅读更多关于它这里

修改你的应用程序建立摇篮文件配置,包括支持库,使multidex输出,显示在下面的摇篮构建文件片段:

 安卓{
    compileSdkVersion 21
    buildToolsVersion21.1.0

    defaultConfig {
        ...
        的minSdkVersion 14
        targetSdkVersion 21
        ...

        //启用multidex支持。
        multiDexEnabled真
    }
    ...
}

依赖{
  编译com.android.support:multidex:1.0.0
}
 

I've read every single thread regarding this issue here and I can't find any answer to my problem.

After adding the Fresco lib I'm getting this error when building my app. The problematic line is: compile 'com.facebook.fresco:fresco:0.5.3+' The error:

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

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_71\bin\java.exe'' finished with non-zero exit value 2

If I take the fresco compile line out, it works.

My gradle looks like this :

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        //classpath 'org.robolectric:robolectric-gradle-plugin:1.1.0'
    }
}

allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
}

apply plugin: 'com.android.application'
//apply plugin: 'org.robolectric'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        applicationId "com.maddogs.mymoney"
        minSdkVersion 11
        targetSdkVersion 22
        //testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
    }
    sourceSets {
        androidTest {
            setRoot('src/test') //note that this is androidTest instead of instrumentTest
        }
    }

    productFlavors {
    }

    lintOptions {
        abortOnError false
    }
}

dependencies {

    compile 'com.facebook.fresco:fresco:0.5.3+'
    compile 'com.facebook.android:facebook-android-sdk:4.3.0'

    compile 'com.facebook.stetho:stetho:1.1.1'
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile 'com.jakewharton:butterknife:6.1.0'
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.android.support:recyclerview-v7:22.2.0'
    compile 'com.android.support:cardview-v7:22.2.0'
    compile 'com.android.support:design:22.2.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
    compile 'com.bignerdranch.android:recyclerview-multiselect:+'
    compile files('libs/Parse-1.9.2.jar')
    compile files('libs/ParseCrashReporting-1.9.2.jar')
    compile files('libs/ParseFacebookUtilsV4-1.9.2.jar')
}

Thanks in advance !

解决方案

Sometimes app:dexDebug error is shown when a library is being included more than once in your project. When the error is not related with any dependencies in your app, then it is probably the 65k method limit problem. The Dalvik Executable specification limits the total number of methods, you can read more about it here.

Modify your app Gradle build file configuration to include the support library and enable multidex output, as shown in the following Gradle build file snippet:

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"

    defaultConfig {
        ...
        minSdkVersion 14
        targetSdkVersion 21
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.0'
}

这篇关于错误:执行失败的任务“:应用程序:dexDebug”。完成非零值2与Facebook壁画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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