Being in Eclipse editing the AndroidManifest.xml the compiler shows me suggestion to add #android:style/Theme_Holo. But when compiling I get the message:
Error: No resource found that matches the given name (at 'theme' with value '#android:style/Theme_Holo')
Is there something wrong with my settings?
Introduced in Honeycomb.
android:theme="#android:style/Theme.Holo"
The holographic theme is new in Honeycomb (SDK level 11). If your project level is set below that, the theme won't be found. (Also note that the graphical layout editor can be set to a higher level than your project setting.)
Had the same error message showing up in the res/values-v11 and res/values-v14 folders of my Android project.
Solved it by setting the AndroidManifest.xml android:targetSdkVersion higher until it matched a version where the theme was available.
Example:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
Works fine for:
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
Also might have to modify the target=<android:sdk-version> line within the project.properties text file.
Related
I keep getting an error the values-v11 folder on the style.xml The error says:
error: Error Retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
I'm using Android SDK 2.3
With android sdk 2.3 you can not control or change behavior of action bar..
for that min sdk should be sdk 3.0 or above.
for further you can see this documentation.
I have created a project with following settings for Target :
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
But following error persists at values-v11 and values-v14:
ERROR : No resource found that matches the given name 'android:Theme.Holo.Light'
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>
Assuming you're using Eclipse, you need to right-click your project in the Package Explorer, select Properties, select Android, and set Project Build Target to API level 14 or higher. Or equivalently, set target=android-14 or higher in your project's project.properties file, but note that this file is autogenerated by Eclipse, so manually editing it is not recommended.
First there is problem in the parent attribute, you have to use parent="android:style/Theme.Holo.Light"
Second, Since Holo Theme was introduced in API level 14... so you have to change your android:minSdkVersion="8" to android:minSdkVersion="11", On newer versions it will automatically use Holo theme. You can further read about Holo Theme at
On Android Developers Blog
on Developers.Android.com
However if you want to support previous versions of Android for Holo Themes. You can use Holoeverywhere library.
TextAppearance.Holo.Widget.ActionBar.Title appears to have been added in API Level 13. Make sure your build target is set to 13, not just 11.
AndroidManifest.xml:
<uses-sdk
android:minSdkVersion=...
android:targetSdkVersion="11" />
you can Click Properties of this project and click Android,chose Target Name byond you aim project.
I have defined a theme in values/themes.xml:
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light.NoActionBar">
</style>
</resources>
and in my AndroidManifest.xml I have:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
The code is compiled and I see the proper result, but IDE tells me it cannot resolve symbol #android:style/Theme.Holo.Light.NoActionBar. Please advice why.
I have the same problem, try to change the android compiling libraries to the 3.2 Android version. It will let you use this themes and should be compatible with previous versions.
Be careful with the API you use. Despite of this you can set your minSdkVersion to 8.
Your minSdkVersion is too low for the Holo theme. The Holo theme is only available on SDK 11 (Honeycomb) and later. You may want to look at ActionBarSherlock. Since it looks like you're not using the action bar, you could also put separate themes.xml files in values and values-v11.
My Android project was working fine when I noticed that I had checked SDK version 4.2 when I meant to target Google 2.33. I set the project back to G2.33 (In the manifest it minsdk = 8 targetsdk=11) and now I have errors on two different styles.xml files in two folders named Values-v11 and values-v14.
the styles.xml in the Values-v14 folder has an error on the following line...
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
the st yles.xml in the Values-v11 folder has an error on ...
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
My other projects, that all target 2.33 don't even have these folders. What is the best way of me getting out of this mess?
Thanks, Gary
You could simply delete these folders if you don't want anything specific for SDK level 11, and the one for 14 won't be used anyway if your targetsdk is 11.
If you want to retain the one for api level 11 for custom behaviour in API level 11, you need to set the project to compile with API level 11 - i.e. if in Eclipse, select the project, go to Properties, select Android and then set the project build target to "Android 3.0" or "Google APIs" for API level 11 if you need the Google APIs.
I am writing an Android app, targeting API levels 8 to 14. I want to use the Theme.Holo.Light theme for API level 11 and higher, and a Theme.Light theme for lower API levels.
The content of res/values/style.xml is:
<resources>
<style name="AppTheme" parent="android:Theme.Light" />
</resources>
and the content of res/values-v11/style.xml is:
<resources>
<style name="AppTheme" parent="android:Theme.Holo.Light" />
</resources>
This compiles well for API level 14, but when setting my target API level to 8, it gives the following error: "Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'" in res/values-v11/style.xml, and "Android AAPT Problem".
If I remove the file res/values-v11/style.xml, the app compiles correctly for API level 8 target.
Now, my understanding is that when compiling for API level 8 the build system should ignore anything inside a resource folder whose name ends with "-v11".
What am I doing wrong?
It's because API 8 got no clue what Theme.Holo.Light is as it was introduced in API11. You have to compile against highest API version you use elements of.
And you understand resource selectors wrong. It's is not used for build the app conditionally. It's used to pick up right resource at runtime.
See this article.