Search code examples
androidapiandroid-manifestandroid-configchanges

"Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden| orien"... in AndroidManifest.xml


Before all, i am a rookie in Android, and i am using API 10 (Gingerbread).

I am developing a simple game with libgdx. But i just install everything for start to work and... in the AndroidManifest.xml this line:

android:configChanges="keyboard|keyboardHidden|orientation|screenSize"

Got the next error in console:_

error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenSize').

I have found in Stackoverflow this answer, i changed to API 13 and works... but i think there should be a better solution than don't make the app less compatible because one line of code (there is much people that still using Gingerbread). There is another way to fix this?


Solution

  • Configure your libgdx Android Manifest like this and specify both min and target sdk version:

    <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19" />
    

    You can use API 5 as the minimum android version as this is what libgdx still supports. Don't get confused about the meaning of the target sdk version: this basically means that you have tested it against latest android version, it doesn't mean that it won't run on previous versions, because you have specified a min sdk before. Rule of thumb: put min-sdk as low as possible and target-sdk as high as possible.

    Configuring it that way your game should still run in old devices and using configChanges like this will work as well:

     android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
    

    I have just recently launched a game with configurations like this and works like a charm even on Gingerbread ;-)