Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'

Solution 1:

In terminal execute in root project folder:

./gradlew clean

It helped me.

Solution 2:

AndroidStudio Menu:

Build/Clean Project

Update old dependencies

Solution 3:

All the above not working for me.. Because I am using Facebook Ad dependency..

Incase If anybody using this dependency compile 'com.facebook.android:audience-network-sdk:4.16.0'

Try this code instead of above

compile ('com.facebook.android:audience-network-sdk:4.16.0'){
exclude group: 'com.google.android.gms'
}

Solution 4:

Open your system command prompt/terminal -> Go to your Project folder path (root project folder ) -> Execute following command : command :- gradlew clean or ./gradlew clean

Make sure that all your gradle dependencies are of same version. -> Example :- your appcompat and recyclerview dependencies should have same version.

-> Change your gradle dependencies to same version like :-

compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'

-> Rebuild your project and it will work fine.

Solution 5:

Use project root in terminal like this:-/Users/rajnish/Desktop/RankProjects/ProjectCloud

After that enter this command ./gradlew clean

It will work.