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

3

7

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?

Nahuatl answered 8/3, 2014 at 23:19 Comment(0)
T
5

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

Thimbleful answered 9/3, 2014 at 0:9 Comment(4)
i get it, but Eclipse still saying that line is a error, and if any error detected, Eclipse will not let me run the game, in the Android emulator with a API lower than 13 :-( is that ok anyway?Nahuatl
That is weird. Maybe try clean & build project in eclipse.Thimbleful
sorry for the delay... that works perfectly! Accepted answer! thanks:-)Nahuatl
Works for Unity3D too. Setting Target API Level to maximum solved problem.Earthnut
B
5

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!!

Bleareyed answered 23/5, 2014 at 11:5 Comment(0)
Q
3

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

Quass answered 18/11, 2017 at 21:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.