I am getting following error on deploying one of the sample projects given by android: android api demos for api level 8 :
error: Error retrieving parent for item: No resource found that matches the given name 'android:style/Theme.Wallpaper'.
at values/styles.xml line 43
<style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper">
<item name="android:colorForeground">#fff</item>
</style>
I have been looking for solutions for over a month now. I have tried rebuilding project, dowloading entire source code again and rebuilding and cleaning.
Help
As Very Well Explain by raychenon.
<style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper" >
<item name="android:colorForeground">#fff</item>
</style>
What is happening is that some styles, like Theme.Wallpaper are not public. You should not extend from them anymore.
Some suggest to revert to platform_tools_r05 HERE
If you want to do the correct way read Xavier July 28 HERE
If you wish to reuse a style that is private, you should copy the
content of that style into your own instead of extending it.
ANSWER
Default theme for windows that want to have the user's selected
wallpaper appear behind them.
<style name="Theme.Wallpaper">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:windowShowWallpaper">true</item>
</style>
Looks like you want to use the above code from the Android source and create your own theme based it.
Hope it Will Helps you.
You can refer to this question posted here and read Xavier's comments on the Google blog..
style reference after SDK and ADT plugin update in mid 2011
Hope it helps..Keep me posted
When you import the Android Samples via "Android projects from existing code", I noticed that the libraries and API number are Android 1.5 and API level 3.
This API Level doesn't support android:style/Theme.Wallpaper.
I fixed it by adjusting the Project Build Target to Android 2.2 (API Level 8) in the Project Properties Menu.
Related
I am new to Android and recently installed Android Studio 1.5. However I'm getting Some problems in Rendering
Rendering problem in Android Studio 1.5
I've tried installing packages and here are those
SDK Tools
I searched forums for help and found some answers. I then selected a lower version of Android API(Android 5.0 instead of Android 6.0). I also tried changing the Theme(Tried Theme.AppCompat, Holo.Light, Material.Light). Then I also edited my styles.xml file in this way
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
instead of
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
I tried every method I found on the Internet, but nothing helped.
The main problem is that I cant See the design interface (or UI, or simply the phone screen) and even if I see it by changing some Settings, I cant add widgets to it and edit the Layout. For example, I cant select the Hello World in default blank activity and delete it.
Friends I am new to Android Development and a very beginner
I changed the android version to use to automatically pick best fit.
It is circled a with blue ink and marked "x" in the image.
This resolved the issue for me.
the first answer works for me on android studio 1.5
ERROR :rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout
open styles.xml ( app --> res --> values --> styles.xml )
remove existing code in <style> tag
insert only this code <style name="AppTheme"
parent="Base.Theme.AppCompat.Light.DarkActionBar"/>
So i have been following the tutorials on the android developer website. i have created an android project with min SDK of 8, and included the compatibility for the android 2.1 for the menu bar. i am able to get the menu bar to work properly for android 4.0 and 2.2, no issues.
now i am trying to set the overlay for the menubar, and i ran into an issue. while setting up a custom theme with the parent being an AppCompact theme, as stated here http://developer.android.com/training/basics/actionbar/overlaying.html .
the code with the issue is :
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.AppCompat">
<item name="android:windowActionBarOverlay">true</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
</style>
2 issues arise:
error: Error retrieving parent for item: No resource found that
matches the given name '#android:style/ Theme.AppCompat'.
and
android:windowActionBarOverlay requires API level 11 (current min is
8)
the first issue, i have no idea why it is being thrown. i use Theme.AppCompact in my manifest and it works. the 2nd issue is confusing me, in the google tutorials it states to include both definitions, as one is for android devices with the new API and the other is for older API's.
i have tried to clean/build my project, it did not help.
Solved by replacing
parent="#android:style/Theme.AppCompat"
with
parent="#style/Theme.AppCompat"
I updated my project from Android 4.2 to Android 4.2.2 and I suddenly get this error in my styles.xml:
<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
<!-- Requires level 11. Current: 7 --> <item name="android:actionBarStyle">#style/Widget.Styled.ActionBar</item>
</style>
How do I fix this? According to the ABS docs this is how it should be done. See: http://actionbarsherlock.com/theming.html
I tried restarting, but I ultimately needed to clean the project: Click "Project->Clean..."
The error came back every time I saved my styles.xml. For now, I am setting my minimum API level to 11 temporarily while editing that file to avoid the errors, and then resetting it back down and cleaning when I want to run it on my low-API-level emulator.
Edit: If you don't like leaving your min SDK version artificially high, it also works for me to change it to 14 (some other high number), save AndroidManifest.xml, change it right back, and save again.
I used the suggested quick fix of Eclipse (CTRL-1 on the underlined element) and just added the warning suppression tools:ignore="NewApi"
<item name="android:actionBarStyle" tools:ignore="NewApi">#style/Widget.Styled.ActionBar</item>
This way you don't have to ignore the whole Lint warning, which might be handy in other cases, and you can compile the project without having to readjust the target API every time you edit the file.
Update: As greg7gkb pointed out in the comments: Don't forget the namespace declaration (xmlns:tools="schemas.android.com/tools").
Ultimately, you really should add the attribute that is giving you the error in an API specific styles.xml file.
This SO answer describes this much better than I could: android:actionBarStyle requires API level 11
I think ALL the other answers are not fixes, but work-arounds (subverting the error, but ultimately not fixing it).
In Intellij IDEA (presumably also eclipse) you can suppress API warnings for the entire file by adding
<!--suppress AndroidLintNewApi -->
Before you declare the schema. So your xml file would then look something like this:
<!--suppress AndroidLintNewApi -->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
< ... />
</resources>
I'm attempting to style the ActionBar, following this blog post:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
With this source code:
svn checkout http://styled-action-bar.googlecode.com/svn/trunk/ styled-action-bar-read-only
However, I'm getting issues in /res/values/styles.xml.
This:
<!-- style for the tabs -->
<style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBarView_TabView">
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
</style>
Is erroring with:
Error retrieving parent for item: No resource found that matches the given name 'android:style/Widget.Holo.Light.ActionBarView_TabView'.
However, using the following answer, and digging through the source for Android, I can see that the theme does indeed exist:
https://stackoverflow.com/a/7149389/420001
The only thing that I changed in the project was moving it from android-11 to android-14, and then running an "Android" > "Fix Project Properties" in Eclipse. I do note that the repo linked to in that answer, that lists the style, is on branch master, so I can't see why the theme would be unfound.
Just for tests, I put that chunk of code in my working android-14 targeting app, minus the background drawable, and it throws the same error.
According to the links in https://stackoverflow.com/a/7837756/1003511 there is a Widget_Holo_Light_ActionBar_TabView but not a Widget_Holo_Light_ActionBarView_TabView. It's possible the resource has been renamed since that tutorial was written. It says the version without the extra "view" has been included since API level 13 - if the tutorial was originally written on 11 it's possible it was renamed in 13, and since you are running 14 you can only see the renamed version. I'd try removing the extraneous "view" and see if the code runs.
You may be missing an '#' character when specifying that you want to look in the android styles:
You can also double check to see if the parent style is listed in the API documentation here:
http://developer.android.com/reference/android/R.style.html
It looks like you may have the name slightly wrong.
I see a lot a similar questions R.java can't compile , No resource found that matches #android:style/ "just after SDK & ADT update" leading to existing projects can't compile
The R.java file cannot be compiled. I find out the errors come from referencing
<style name="Theme.Wallpaper" parent="android:style/Theme.Wallpaper" >
<item name="android:colorForeground">#fff</item>
</style>
What is happening is that some styles, like Theme.Wallpaper are not public. You should not extend from them anymore.
Some suggest to revert to platform_tools_r05
http://groups.google.com/group/android-developers/browse_thread/thread/550fce9670530d9b/9b2b2aa389dce367?show_docid=9b2b2aa389dce367&pli=1
If you want to do the correct way
read Xavier July 28
http://groups.google.com/group/android-developers/browse_thread/thread/550fce9670530d9b/9b2b2aa389dce367?show_docid=9b2b2aa389dce367&pli=1
If you wish to reuse a style that is private, you should copy the
content of that style into your own instead of extending it.
Ok so Where do I find the content of the (private) style ?
Seriously, after an update I don't have time to correct platform mistakes when the project code worked right.
<!-- Default theme for windows that want to have the user's selected
wallpaper appear behind them. -->
<style name="Theme.Wallpaper">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:windowShowWallpaper">true</item>
</style>
Looks like you want to use the above code from the Android source and create your own theme based it.