The project gets built without error from Android Studio -> Build -> Build APKs and after installation it works fine. But running the project with a Run Configuration gives
In your gradle properties: remove android.enableAapt2=false, and upgrade the buildToolVersion in your app build.gradle and in all the other modules(if used) too.
Run the command gradlew --info assembleDebug in your terminal and check for other errors and if you find them then manually go and fix them. In my case there was a 9 patch image which was causing all the trouble.
Try to clean and rebuild your project.
Or
Try to disable instant run feature and see if it works.
Or
Try and enable multiDexEnabled.
defaultConfig {
multiDexEnabled true
}
Or
File -> Invalidate caches and restart