While using Android Studio I encountered the following error:
![enter image description here](https://i.stack.imgur.com/soOAT.png)

The date of the APK is 2 days older than the current one (Gradle is used to append the build date to APK name). I've checked folder *\build\outputs\apk*, and an APK with the correct date has indeed been generated:
![enter image description here](https://i.stack.imgur.com/AzY06.png)

The follows have been tried:

* Build -> Clean Project
* Build -> Rebuild Project
* File -> Invalidate Caches / Restart...

How do I fix this so the correct APK can be uploaded to device to run?

---

**Edit:**
Changed the title to better reflect the circumstances where this issue would occur. It appears that Android Studio would remember the APK names provided by Gradle when it's been synced with Android Studio, but does *not* update the APK names when Gradle is ran to create the actual files.

In my situation it's caused by the fact that the current date is appended to the APK name, so if I synced Gradle to Android Studio on 12/3 Android Studio would remember the APK filename to be *app\_2014-12-03.apk*). Then using Gradle build and run the app on 12/4 would cause the disconnection between Android Studio and Gralde, where Gralde generated *app\_2014-12-**04**.apk* and yet Android Studio still remembered the APK filename to be *app\_2014-12-**03**.apk*.