97

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:

  1. Either change the api (from preview window pane) from 22 to 21, or

  2. Change the App Theme from "Project Theme" to any other theme.

  3. 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

Pooja
  • 2,417
  • 20
  • 39
Ashish Goyal
  • 1,284
  • 1
  • 13
  • 22
  • 1
    For me, even the first two steps don't solve the problem... I'm getting "rendering problems" with all layouts that have views from android.support.*. This is frustrating! – user1987392 May 02 '15 at 17:09

7 Answers7

162

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.

SoftWyer
  • 1,986
  • 28
  • 33
eee
  • 2,047
  • 1
  • 13
  • 6
  • 29
    Wow, what a lame out of box experience in Android Studio. – Warren P May 17 '15 at 04:09
  • 6
    If I want to use "Theme.AppCompat.Light.NoActionBar" then what? – Haseeb Jadoon May 26 '15 at 12:38
  • I tried both – Santacrab Jul 10 '15 at 07:47
  • 4
    Strangely, adding the word "Base." worked for me. "All your base are belong to us." – SMBiggs Aug 08 '15 at 18:03
  • 1
    Worked for me too...I am working on an old app and the Base fixed the error! – Dumbo Nov 18 '15 at 01:55
  • @warren-p Totally. Agree. Came here due to the same issue. I was actually pretty excited to get into Android development and at the very least try it out and have an opportunity for a wider audience including developing markets. I had no idea that even the Android IDE was so buggy, clunky and ugly. The IDE has more of a learning curve than Java! It's like I'm using a web based Java app from 1990. Just opening up Android Studio makes me appreciate Xcode/iOS about 100x more. – Edison Feb 28 '16 at 01:27
  • 1
    Why does precisely defining the theme fix the issue? – Robert Aug 23 '17 at 23:41
  • Adding Base as prefix worked for me too. My styles.xml is as follows – Alok Rajasukumaran Sep 15 '17 at 06:49
  • @Haseeb Jadoon Fear not... you can still remove the ActionBar by updating the "windowNoTitle", "windowActionBar", "android:windowFullscreen" and "android:windowContentOverlay" items in your style. See the selected answer in https://stackoverflow.com/questions/36478925/why-is-apptheme-noactionbar-not-working – JHowzer Sep 20 '17 at 01:23
29

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.

enter image description here

Originally answered here : Rendering problems in Android Studio v 1.1 / 1.2

Just reposting

Community
  • 1
  • 1
Sagar Devanga
  • 2,815
  • 27
  • 30
16

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!

sudoz
  • 3,275
  • 1
  • 21
  • 19
3

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.

ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
1

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.

0

You don't need to change the theme. Maybe your're extending ActionBarActivity (deprecated) instead of just Activity. Change it, and build the project.

Kley
  • 1
  • 1
  • New rules @Kleyton ,Instead of extending ActionBarActivity (which is now deprecated), it is advised to extend AppCompatActivity (as per google android developer pages). – Ashish Goyal May 26 '15 at 12:31
0

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

Andrecon
  • 113
  • 2
  • 12
  • New rules have come up bro! Instead of extending ActionBarActivity (which is now deprecated), it is advised to extend AppCompatActivity (as per google android developer pages). – Ashish Goyal May 26 '15 at 12:30
  • Does it work the same way Activity does? And does it take care of the XML rendering issues? – Andrecon May 29 '15 at 23:04
  • As per google android developer pages, it (AppCompatActivity) does take care of everything that ActionBarActivity used to do – Ashish Goyal May 31 '15 at 10:44