Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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?

like image 812
yukatta Avatar asked Mar 08 '14 23:03

yukatta


3 Answers

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 ;-)

like image 59
donfuxx Avatar answered Nov 15 '22 01:11

donfuxx


I've spent three days of my life (and almost my marriage), but I have one different answer. Is hidden. I had correct the minsdk, the target. The, why??? because of the |. I had the elements of configChanges sepparated by /, but that's not correct. Yu have to sepparate them with | . But in cursive is difficult to realise what is. So, be careful with the |

I hope this answer helps!!

like image 28
Xose Sanchez Avatar answered Nov 15 '22 02:11

Xose Sanchez


Just lost a lot of time too. This was the issue:

Caused by - AAPT tool does not allow density value for the configChanges until API level 24

Fixed in - 2017.3.0b8, 2018.1.0a1, will also be backported to 2017.2, 2017.1 and 5.6 patch releases

link to unity forum

So apparentlly it's a bug in the latest version of the unity editor at the time of writing. (2017.2.0f3) It adds 'density' to configChanges in AndroidManifest.xml which is not supported in android versions below 7.0 (API level 24).

like image 3
Johan Claes Avatar answered Nov 15 '22 02:11

Johan Claes