24

I updated few days ago to Android Studio 2.0 and everything worked fine, but today when I tried to compile the project, I received the following error in the Logcat:

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

Exception while doing past iteration backup : Source \app\build\intermediates\builds\debug\184802777347678\classes.dex and destination \app\build\intermediates\builds\debug\184802777347678\classes.dex must be different

The error tells me that the same .dexmust be different, so I'm quite confused. How could I solve it?

Alvaro
  • 1,430
  • 2
  • 23
  • 41

11 Answers11

54
  1. Clean Your project.
  2. And try to rebuild it.

If you did it then enable mutidex in app base build.gradle file.

multiDexEnabled true
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
Ankita Shah
  • 1,866
  • 16
  • 31
6

Just add below line in your app Gradle dependencies

compile 'com.android.support:multidex:1.0.0'

and then below line in defaultConfig

multiDexEnabled true
Bajirao Shinde
  • 1,356
  • 1
  • 18
  • 26
5

The way I solved the problem was by just deleting the file!

Alvaro
  • 1,430
  • 2
  • 23
  • 41
2

just go and delete the build folder in your app folder. invalidate cache and clean your project then Rebuild...

Ismael ozil
  • 573
  • 5
  • 6
1

I am using Android Studio 2.2.1 and had the same error. I resolved this by deleting the folder containing the classes.dex file. In my case it was in the 32129143802723 folder from C:\Users\ME\AndroidStudioProjects\myApp\app\build\intermediates\builds\debug\32129143802723\classes.dex.

From the menu bar I went to File the selected Invalidate Caches/Restart... Then Invalidate and Restart option.

That fixed the issue. The error was gone and I was able to launch the app. Hopes this helps.

Chandler
  • 21
  • 1
  • 3
1

So I just cleared the data on the app installed on the phone, and then uninstalled the app. Next time I ran it, it worked without any problems.

Kraven
  • 11
  • 1
1

You just Disable the antivirus make sure it will help you!

then , click clean project and Rebuild it.

0

I solved it renaming folder "build" inside my project folder. When you build again, android studio creates a new build folder.

0

I just click on Build and on the drop down, click clean project, this fixes it very quickly

cynthia n
  • 9
  • 2
0

The only thing which worked for me flutter clean on command line. It does similar to ./gradlew clean

Chandru
  • 5,954
  • 11
  • 45
  • 85
0

Try invalidating and restarting caches in android studio. File > Invalidate Caches / Restart

Nonso
  • 1