I faced a similar problem after refactoring.
This is what i did to resolve this issue:
And everything worked fine!
I think the key is to restart your IDE.
Hope this helps you or anyone else!
If the above steps don't work for you, then deleting Gradle cache seems to be a solution, as pointed out by @Yasitha.
As suggested by a couple of users in the comments below, sometimes the issue can be resolved by completely removing and reinstalling the app from your device.
adb uninstall <package> in terminal to completely remove app from the device.
As mentioned in Abhishek's Answer, one should also try deleting the app from your device in case multiple users are set up on your device.
Simply go to
Mobile Settings > Apps > [Your App] > More > Uninstall App for All Users
UPDATE for Android Studio 2.1 and up
When running Android Studio 2.1 and up you can also encounter this issue when you have the instant run option enabled in your preferences (is enabled by default).
To disable this option go to the
Preferences option in the
Android Studio top menu and look for
Instant Run so you can uncheck the first checkbox on that screen.
Anyway that fixed it for me. Originally pointed out by user @yusufonder. I discovered this was the issue since gradle install still worked.
~ Answered on 2014-06-16 10:32:58