Something to complement: I have updated an app recently, the previous was working in both landscape and portrait mode, and I want the updated version should work in portrait mode, so I added
android:screenOrientation="portrait"
to the corresponding activity, and it just crashed when I tested the update. Then I added
android:configChanges="orientation|keyboardHidden"
too, and it works.