Exception while doing past iteration backup: Source

AndroidAndroid Gradle-Pluginbuild.gradle

Android Problem Overview


I am working on Android project. I connected my phone to Android Studio in order to test the app. After second upload Gradle Build failed and gave this error:

>Error:Execution failed for task ':app:buildInfoDebugLoader'. > > Exception while doing past iteration backup : Source /home/ziyaddin/AndroidStudioProjects/Test/app/build/intermediates/builds/debug/19181584762318/classes.dex and destination /home/ziyaddin/AndroidStudioProjects/Test/app/build/intermediates/builds/debug/19181584762318/classes.dex must be different

What can be the reason for that? How to solve this problem?

Android Solutions


Solution 1 - Android

I solved this issue by Build -> Rebuild Project and then Run again.

Also I think newly added menu Run -> Clean and Rerun should also fix this issue.
[EDIT:] Clean and Rerun is removed in Android Studio 2.3

Solution 2 - Android

I also encountered same issue, it solved by rebuilding the project.

Build-> Rebuild Project

and then

Run

I think this is only occuring on new Android Studio update from 2.0.

Solution 3 - Android

I have this problem and solved by removing all directory (or only one) from directory ../app/build/intermediates/builds/debug/.

in this example: /home/ziyaddin/AndroidStudioProjects/Test/app/build/intermediates/builds/debug/19181584762318

Solution 4 - Android

i solved this by invalidating cache, Rebuilding the project, and then running it, it worked fine.

Solution 5 - Android

Steps to take:

  1. select Build

  2. Select Rebuild project

  3. run project

Solution 6 - Android

I have just had this issue, and solved by unplugging my phone and running in the emulator. This built okay, and then subsequent tests on my phone were successful. In doing this, I also commented out my savedInstanceState Bundle, which may have been a contributing factor. I think this is potentially an internal glitch with Android Studio.

Steps to take:

  1. Comment out Bundles/Saved States
  2. Run on Emulator only
  3. Retry with Phone
  4. Add back Bundles/Saves States
  1. Try running on device again, all should be good.

Solution 7 - Android

Rebuild project works fine in Android Studio 2.2.2

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZiyaddin SadigovView Question on Stackoverflow
Solution 1 - AndroidsohailehmadView Answer on Stackoverflow
Solution 2 - AndroidGurvinder SinghView Answer on Stackoverflow
Solution 3 - AndroidigorView Answer on Stackoverflow
Solution 4 - AndroidIsmael ozilView Answer on Stackoverflow
Solution 5 - AndroiduttambhagaurView Answer on Stackoverflow
Solution 6 - AndroidJake BView Answer on Stackoverflow
Solution 7 - AndroidMrCesterView Answer on Stackoverflow