4

I have added recyclerview gradle build and then tried to run the app, and now I get this 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_79\bin\java.exe'' finished with non-zero exit value 2

Here is my gradle build file:

dependencies { compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.android.support:recyclerview-v7:22.1.1' compile fileTree(dir: 'libs', include: 'Parse-*.jar') compile 'com.parse.bolts:bolts-android:1.2.0' compile 'com.android.support:design:22.2.0' compile 'com.google.android.gms:play-services:7.5.0' compile 'com.facebook.fresco:fresco:0.5.2+' compile 'com.facebook.android:facebook-android-sdk:4.1.0' compile fileTree(dir: 'libs', include: 'commons-io-*.jar') compile fileTree(dir: 'libs', include: 'ParseFacebookUtilsV4-*.jar') } 

How to fix this?

2
  • You might want to run Gradle from the commandline with the "--debug" flag to get some more info. e.g. ./gradlew clean build --debug Commented Jul 8, 2015 at 15:32
  • 1
    How to run Gradle from the cmd? Commented Jul 8, 2015 at 15:37

2 Answers 2

8

It looks like you have reached the dex limit and you have over 65k methods in your application.

If you want to keep all of your gradle dependencies as is, you should look into configuring multidex that way it will build your application using multiple dex files.

Another solution would be to try and remove any unnecessary dependencies from the google play services library. Chances are you don't need to include everything and you can choose to add only the imports you need.

For example:

com.google.android.gms:play-services-maps:7.5.0 com.google.android.gms:play-services-gcm:7.5.0 

Rather than simply using:

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

You can reference the Google Play Services guide to determine which pieces of library you should add.

Sign up to request clarification or add additional context in comments.

Comments

1

Android Studio suggests,

Avoid using + in version numbers can lead to unpredictable and unrepeatable builds.

+ in dependencies lets you pick up automatically the latest available version rather than a specific one, however this is not recommended.

You may have tested with a slightly different version than what build server used.

After Removing Plus Sign and Adding a Specific Version problem was solved.

1 Comment

palak what does it mean actually what is the solution this kind of issue .

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.