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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With