Android – Theme.Holo in styles.xml with level < 11 causes validation error in Eclipse ADT

androideclipse-adt

I try to use the alternative resources / theme selector solution found here to switch to the Holo theme on new devices. The project uses Android 2.1 as project build target.

Hoewever if I put this XML in res/values-v11/styles.xml

<resources>
    <style name="AppTheme" parent="@android:style/Theme.Holo" />
</resources>

Eclipse indicates an error:

Error retrieving parent
for item: No resource found that matches the given name
'@android:style/Theme.Holo'. styles.xml /MyApp/res/values-v11

The manifest sets these SDK values:

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="15" />

I can only compile this project if I set the Project Build Target to Android 3.0, but then it will not run on older devices.

So this style selector workaround can not be used wit Eclipse ADT. Is this a bug in the Eclipse ADT, should the v11 styles.xml not be ignored by the ADT?


Update: I could use a workaround and set the file content to

<resources>
    <style name="AppTheme" parent="@android:style/Theme" />
</resources>

to activate the default theme.

Best Answer

You can run the App on Android 3.0< if you set android:minSdkVersion to a lower API. So just set the target to API Level 11+ but set minimum SDK to 10<.