Error: execution completed for task: app: dexDebug. finished with nonzero exit value 2 with facebook fresco

I read every single thread regarding this problem, and I can not find the answer to my problem.

After adding the Fresco library, I get this error when creating my application. Problem line: compile 'com.facebook.fresco:fresco:0.5.3+' Error:

Error: execution completed 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' completed with a non-zero exit value 2

If I take the fresco compilation line, it works.

My gradle is as follows:

 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!

+5
source share
1 answer

Sometimes app:dexDebug displays an error when the library is included more than once in your project. When the error is not related to any dependencies in your application, this is probably the problem with the 65k method limitation. The Exkable Dalvik specification limits the total number of methods, you can read about it here .

Change the configuration of the Gradle application file to enable the support library and enable multidex output, as shown in the following Gradle assembly file fragment:

 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' } 
+13
source

All Articles