cordova – PhoneGap/Android – Locking orientation to portrait-ThrowExceptions

Exception or error:

I have tried every method to lock the screen to portrait orientation but they simply do not work after testing the app via Adobe PhoneGap Build.

Firstly, I have modified the file to include at onCreate


Secondly, I have modified the config.xml file to include

<preference name="orientation" value="portrait" />

Thirdly, I have modified the Manifest file to include


None of the above are working.

How to solve:

If you’re using Cordova 3.4.1 <preference name="orientation" value="portrait" /> should work.

Also, don’t forget to add: android:configChanges="orientation" in the activity tag.

Else, you can try using this plugin:


Update the config.xml File which is in your project folder, above www.

Add the line:-

<preference name="orientation" value="portrait" />

Then build you project & there will be no Orientation Change.

In place of “portrait” you can use “landscape”.


just put below in activity tag below application tag in android manifest.xml file



Leave a Reply

Your email address will not be published. Required fields are marked *