when I update to android 3.1.3 the design screen not showing anything I googled it and found the solution to change the appTheme parent to
Base.Theme.AppCompat.Light.DarkActionBar
instead of
Theme.AppCompat.Light.DarkActionBar
and worked perfectly.
my question is
why doesn't it work with default one and what is the difference between two themes?
There shouldn't be any difference. If you look up style definition in values.xml of your appcompat library, you can see that Theme.AppCompat.Light.DarkActionBar just extends Base.Theme.AppCompat.Light.DarkActionBar and nothing else.
The problem seems that there was a bug with how Android Studio handled some versions of the support library. You can find a more detailed answer here:
Failed to load AppCompat ActionBar with unknown error in android studio
Anyway, after updating Android Studio to 3.2 and Gradle to 4.6, the problem is gone.
Related
Render problem
Failed to find style 'cardViewStyle' in current theme Tip: Try to refresh the layout.
Missing styles
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.
Cardview render correctly in SDK 26.1.0,27.0.1,27.0.2
Try converting gradle to this:
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
I had the same issue and this worked for me.
I had the same issue and therefore finally changed the card view from :27.1.0 to 26.1.0.
Try converting all support libraries as per my gradle and then sync it. See if it works?
gradle
for whoever came here and spent so much time on figuring out what to do, Just download Android Studio Canary then extract use this Tutorial to install it along-side the other version you have and it will handle your problem.
Update your Android Studio version with latest version and use SDK 28.
I am just a beginner to android app development. When i created a new project on Android Studio 1.1.0,
it gives up this error
"rendering problems
The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout"
Now i have searched about this on google, and i found possibly 3 solutions given by most of the people.
They say:
Either change the api (from preview window pane) from 22 to 21, or
Change the App Theme from "Project Theme" to any other theme.
be sure to have imported right appcompat-v7 library in your project structure -> dependencies,
Refer these steps:
Add the support library feature project identifier to the dependencies section. For example, to include the appcompat project add compile "com.android.support:appcompat-v7:18.0.+" to the dependencies section, as shown in the following example:
dependencies {
...
compile "com.android.support:appcompat-v7:18.0.+" }
Note: My android support lib is up-to-date (installed it using SDK Manager).
Following first two steps, removed the error. But I feel that these are not the permanent solutions, the Second step seems just like a temporary workaround. I have doubts about the First step also, that if to remove the error, we change api from 22 to 21, then at the end, our app wont work in Android 5.1.1(API 22), it would be restricted to Android 5.0.1 and below only (API 21). Are my doubts valid?
Regarding the third step, is it the permanent solution to this problem?
P.S : Sorry for mismatching tags, wasn't allowed to add exact tags due to site reputation
Fix res/values/styles.xml like so:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"/>
Detailed explanation as requested: Theme.AppCompat.Light.DarkActionBar is a subclass of the superclass Base anyway. Ctrl+click (Android Studio) on it and you will be taken to the source:
<style name="Theme.AppCompat.Light.DarkActionBar" parent="Base.Theme.AppCompat.Light.DarkActionBar" />
We didn't change anything, we just defined it more precisely.
This is a known bug since Android Studio build 1.1 (it is also still in 1.2 and 1.3 preview). Switching the preview's API level from 22 to 21 fixes the for most people. While waiting for a fix you could try it as well.
Originally answered here : Rendering problems in Android Studio v 1.1 / 1.2
Just reposting
Modify src/res/values/styles.xml
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"></style>
Then select API22, you'll find this problem fixed!
After this error, I'm using :
API-22 Android 5.1.1 and still this problem exist.But you can at the top of the android studio toolbar, Choose:
Material Light -> Material Light
and then you can see the preview with Toolbar and light theme.
Hope this helps.
I fixed this problem by switching to the Holo Dark theme, then back to the App theme. I just clicked the button above the viewer that says App theme next to the rotate view in Android Studio. About 10% of the time, that alone doesn't work and I also have to change the API of the viewer from 22 to 19.
No idea why this works, but the suggestions provided above did not work for me.
You don't need to change the theme. Maybe your're extending ActionBarActivity (deprecated) instead of just Activity. Change it, and build the project.
If you do change the activity from ActionBarActivity to just Activity, don't forget to import the Activity itself. That is
import android.app.Activity
It sucks but hey, it's their fault and not ours.
Also you can simply change the theme by pressing the "AppTheme" and choose Holo.Light.DarkActionBar. It updates the styles.xml file automatically.After that, rebuild the project.
I did all these and it works for me though i think them guys at Google and IntelliJ should do something about this rendering problem since we have been told to move from Eclipse to Android Studio
I recently updated Android Studio to version 1.2 and my AppCompat library to v22.0.0, SDK-Build-Tools version to 22.0.1. My target and compile sdk-version is 22 and my 'min-sdk-version' is 16.
The problem I am having is that in the xml-layout preview, I am getting an error namely: "Rendering Problems, the following classes cannot be found: android.support.v7.widget.Toolbar". I did some surfing on the internet and tried the already provided solutions. They are as follows:
Changing my (xml) preview to show android version target 21 or Android 5.0.1, 19, and 17
Changing my styles theme to Holo.NoActionBar and other themes as well.
Changing my minSdkVersion to 21 (above 20 basically)
Restarted Android Studio... Twice
Built the project about 5 times.
However, the problem still remains and I'm out of ideas. Could really use some help here. Thanks...
Also: The classes import just fine in my java file. It's just the preview.
EDIT: The preview works fine when I use android.widget.Toolbar. And my DrawerLayout doesn't work. I'm guessing there's something wrong with rendering the widgets from the support libraries?
I had a similar problem and you may want to try to change the app theme in the style.xml to an appcompat app theme for example with mine I changed it to something like this.
<style name="AppTheme" parent="#style/Theme.AppCompat.NoActionBar">
<item name="windowActionBar">false</item>
<!-- Customize your theme here. -->
</style>
and then go to the Android Manifests file
<application
android:theme="#style/whatever_you_named_your_app_theme">
In the Android Manifests file you write whatever you wrote in the styles.xml under <style name=""
There is no need to lower your apps targetSDK.
Give me feedback if it worked for you
I wiped out my entire project and started all over again. That seemed to solve the problem. I'm guessing changing my configurations in between is what caused the mess. Thank goodness the project was just for recreation.
Im using Android Support Library v7-AppCompat in my app, i have imported the v7-AppCompat as a library for my app and it works with the code the problem is when i try to apply the AppCompat theme to the app. I have included the modules and the library as well, but still the theme is not working. Even tried copying the themes.xml and theme-base.xml to the values folder but it only results in more errors.
you are using this parent="#style/Theme.AppCompat.Light.DarkActionBar" instead use this parent="#android:style/Theme.AppCompat.Light.DarkActionBar".i guess they have typo in the docs file
Try changing the compile Version of your app to the latest sdk you have installed ie 22 or 23 and it should work.
When I import the Support Library v7 into my workspace in eclipse, I get this error:
error: Error retrieving parent for item: No resource found that
matches the given name '#style/ Theme.Holo.Light'.
I have another library project that both link to the appcompat library. The funny thing is that I can build and run my project fine when I remove the styles.xml for values-v14. So I can work without Holo theme but it seems really strange that I lose the styles that should be there?
I'm working in eclipse with latest ADT. I've tried cleaning my project, closing / opening eclipse and the project and re-importing the appcompat into my workspace. Also setting the build target to 19 for both of the linked library projects
Any help would be appreciated
Try using Theme.AppCompat.Light instead reference
It appeared to be a problem with Eclipse/ADT and I have fixed it now. Basically I had previously removed the values-v14/styles.xml file and then at a later date copied the values-v11/styles.xml back into the values-v14 folder. However it didn't properly recognise that it was now in v14 styles.
The solution was to delete the values-v14/styles.xml and add a new one.