I'm new to Android development and I just installed Android Studio version 1.2.1.1. I created a project, HelloWorld, and chose the default blank activity, Darcula theme, and default API. Straight out of the box, without having written any code or touched anything, I get this message:
"Rendering Problems
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style 'textViewStyle' in current theme (4 similar errors not shown)."
I uninstalled and reinstalled Android Studio but I still get this error so I'm not sure what else I should do. It says "use the theme combo box... or fix the theme style references" and I'm new to Android Studio so I have no idea where the box is or how to change the reference.
Simply click on the Refresh icon at the review pane:
Android gives you the option to define your own style format, which the default project you made did. It created a style named 'textViewStyle'.
If you look at the text view instead of the design view (you can switch by pressing the tab at the lower left in the part where you get the error that it can't render) you will see that the textView or the app itself contains a line android:theme="#style/textViewStyle".
You can either remove this line, or track down the error in the styles.xml file in the res/values folder. This is the file that defines the style for the app.
If this doesn't help you it could be that the style is defined in your AndroidManifest.xml file, look at the tag, it will contain a line saying android:theme="#android:style/textViewStyle", change that to android:theme="#android:style/Theme.DeviceDefault" and you should be good to go.
More info on custom themes: http://developer.android.com/guide/topics/ui/themes.html
Since you are a beginner, more on general Android development:
http://developer.android.com
Make sure to select the correct theme from the menu in the preview panel.
If you set the layout file to be FullScreen in the manifest but select something like NoActionBar theme in the preview panel, you will also get this error.
Go to manifest file, check the theme you are using there and pick the same in the Design view of your xml file.
Rebooting Android Studio did the trick for me. I couldn't find the "Refresh" button in the accepted answer for some reason.
Click on "Design" tab
On the right pannel, search for the objet "text" that contains something like "#string/hello_world"
Remove this value from the field
There's no more error.
Related
I am very new to app development and I am facing this error in issue panel in android studio
Failed to find '#attr/shapeAppearanceSmallComponent' in current theme
i am also facing a warning
Missing styles. Is the correct theme chosen for this layout?
After searching on web i found that this is caused by the wrong theme selected in AndroidManifest.xml.
So as i can understand this:
There is a file for every theme and have some values defined in it.
Theme is defined in AndroidManifest file, is a way to tell compiler that theme related values are saved in given file.
For me i have selected wrong theme file and my app is trying to find an attribute #attr/shapeAppearanceSmallComponent which it can't find because it is not available in theme passed in AndroidManifest.
My app want this attribute as i am using something which need this to be defined (maybe like material TextInputLayout).
Still this is my theory, i am no where near any answer
Now things i want to understand.
: Even if there is a problem in my application, i am still able to compile it and deploy on a device and it is running fine, In which case i can have issue because of this error.
If my theory is right than i have few questions:
If i am using some element (Button or EditText), how would i know that which theme does it support
What if i want elements from different themes to be used in a single application.
One more thing i observed is that in drop down menu in design view for activity_main.xml after changing the theme to Material3.dark from MaterialComponents removes the error.
error image
no error image
If i change theme in design layout using drop down menu it won't change automatically in Manifest file. So will it be true to say that changing themes using that drop down menu is just telling me, how my app will look using that theme, and if it is showing an error i shouldn't use that theme and use one which is not giving any kind of render error.
I will post my AndroidManifest or my activity_main if required
AndroidTagGroup is a widget for adding Tags. I am trying to use it in my app. I have added dependency compile 'me.gujun.android.taggroup:library:1.4#aar' , and am using it as
<me.gujun.android.taggroup.TagGroup
android:id="#+id/tag_group"
style="#style/TagGroup" />
But the layout is not getting rendered and is giving two errors,
Failed to find style 'tagGroupStyle' in current theme and Missing styles. Is the correct theme chosen for this layout? . I cant find any other theme related to TagGroup, the theme i am using is appTheme. I tried defining TagGroup style in the styles.xml, but no use.
Edit
The render error is shown in Android studio studio. Even if i build and run the app, I cant see the widget in the app.
Edit 2
As #CommonsWare suggested, after adding Tags i can see the widget in app. Only issue remaining is the rendering issue, which from the comments seems like a android studio issue.
I recently started to learn Android development. But when I click themes, to change it, it says:
Rendering problems. Missing styles....
Then I can't push any Layout or view into the app.
I tried clicking Auto add all the missing attributes, but it doesn't do anything.
One of them works though - only the Manifest Theme.
These screenshot might help:
Screenshot 1
Screenshot 2
See in the image click on Overscan then the dialog is propmt change the Theme to Holo light the error will disappear.
Image :
In my android XML Graphical Layout, it can not display my ToggleButton. I get some errors (see below). I have checked all other components in the Palette window and the only component that fails to load is ToggleButton. The problem is not project specific. It persists in every project I create.
Note: I have tried dragging it directly as well as using XML code to generate it. But it fails either way and the error is same.
Error :
Exception raised during rendering: -1
Exception details are logged in Window > Show View > Error Log
The graphics preview in the layout editor may not be accurate:
Different corner sizes are not supported in Path.addRoundRect. (Ignore for this session)
Path.isConvex is not supported. (Ignore for this session)
I have referred this question and tried to edit it but the edit was rejected. So please do not redirect me there.
I am using API 21. All the build tools are installed.
I had the same problem and solved by changing my target device screen to any of the xhdpi OR xxhdpi devices.
I'm sorry but I'm not able to post images yet, all you have to do is go to the dropdown menu just above the graphical layout -> General OR Google -> Select the xhdpi/xxhdpi target device you prefer.
I'm also new to android so I'm not able to explain why this is happening, I can only guess it's a compatibility issue or something. I'll try finding out more..
In the meantime I hope this will turn useful for you as well :-)
Problem is in your background drawable. Corners of your rectangle can be rounded all only by a same amount. Just like your error message says. You must set them all to same amount.
Perhaps it is the display theme so ensure that the theme you select matches the android:theme in your activity tag in AndroidManifest.xml. In Android Studio (sorry not eclipse as per question) in the top bar of the preview panel, I had to click the current theme name (which was Light) which brings up the Select Theme panel and then choose my theme under Project Themes (as I had a custom theme - you location may vary).
I am getting this message in my xml
"Use the Theme combo box above the layout to choose a different layout, or fix the theme style references."
So can you please tell me that what is combo theme and how to implement this in my app.
Close your layout files in the editor and restart your Eclipse.
If you are using Android 3.0 and above on your Graphical Layout. Try changing it to Android 2.2 or 2.3.
update your Android studio to latest version and after that update your gradle