58

I just update Android Studio, and when I restarted it, the preview window rendering failed, and I was told that

The following classes could not be found: - android.support.v7.internal.widget.ActionBarOverlayLayout

If someone can tell me what can I do to fix this rendering problem? Thank you.

Manuel Allenspach
  • 12,467
  • 14
  • 54
  • 76
Kyung Lee
  • 925
  • 1
  • 10
  • 21

6 Answers6

88

You have to do two things:

  • be sure to have imported right appcompat-v7 library in your project structure -> dependencies
  • change the theme in the preview window to not an AppCompat theme. Try with Holo.light or Holo.dark for example.
Giorgio Antonioli
  • 15,771
  • 10
  • 45
  • 70
  • 6
    I'm a totally newbie , I don't know how to import appcompat-v7 library in my project structure -> dependencies, I can't even find out " project structure -> dependencies" , could you please explain it more detail ? – Kyung Lee Mar 22 '15 at 13:00
  • 1
    @Pallad if you are using Windows press CTRL+ALT+MAIUSC+S and then go on dependencies tab, add a library dependency pressing on the + button in the corner and select appcompat v7. But i think that this isn't necessary for your purpose, if yours is simply a rendering problem, the second point is the one useful to you, change simply the theme. – Giorgio Antonioli Mar 22 '15 at 13:04
  • More general: under the File menu there is an option "Project Structure". You can also get here from the "Fix Build Path" link in the error message. – S.L. Barth is on codidact.com Mar 28 '15 at 21:38
  • For me, the default selection in the preview window, when making a new Blank project (only holds "Hello world!") is Project Themes "AppTheme". When I select "Base.Project.AppCompat" the error concerning the ActionBarOverlayLayout disappears. I am having trouble finding explanations as to what is going on! Is "App Theme" simply a heading, not an actual theme? Why is the project even trying to find a Layout that is not being invoked by any code or any discernible references to it? – Phil Freihofner May 01 '15 at 03:27
  • @Phil Freihofner AppTheme isn't simply a heading for your project i think. In your manifest i think you have android:theme="@style/AppTheme". So by default in the preview window Android Studio tries to show you your actual theme that probably is extending Theme.AppCompat now – Giorgio Antonioli May 01 '15 at 10:52
  • I have imported right appcompat-v7 version 22.1.1 But still i am receiving this error. Please help. – Malwinder Singh May 21 '15 at 08:34
  • @M.S. switch the theme to not an AppCompat one or Base theme one. Try with a non app theme like Holo and in case it doesn't work, change the api version in the api chooser of the preview window – Giorgio Antonioli May 21 '15 at 08:41
  • I don't want to change the theme, i want to use the current theme. Any solution? – Malwinder Singh May 21 '15 at 08:49
  • 1
    @M.S. change the api version in the preview window – Giorgio Antonioli May 21 '15 at 09:31
  • 2
    It seems like we are finding alternate ways but not finding the solution to the problem. Problem is why API 22 says class `ActionBarOverlayLayout` not found? – Malwinder Singh May 21 '15 at 12:51
  • 1
    @M.S. I don't know. It would be a bug in latest Android Studio's updates. But i'll be totally honest: i don't want to know it, i think that no one needs it, it's only a bit boring bug that doesn't change your user experience in Android Studio if you downgrade api level by one in preview window! Just a taught about it. – Giorgio Antonioli May 21 '15 at 13:06
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/78448/discussion-between-fondesa-and-m-s). – Giorgio Antonioli May 21 '15 at 15:34
  • 3
    The second option worked for me. but i dont understand why google is not solving such a stupid errors ? or at least guide us to solve it!! – MBH Jun 19 '15 at 13:14
  • 1
    what is logic behind changing theme, you changed theme, it may not solved actual problem – blackHawk Jun 04 '17 at 06:02
47

Please see the following link - here is where I found a solution that worked for me.

Rendering problems in Android Studio v 1.1 / 1.2

Changing the Android Version when rendering layouts worked for me - I flipped it back to 21 and my "Hello World" app then rendered the basic activity_main.xml OK - at 22 I got this error. I borrowed the image from this posting to show you where to click in the Design tab of the XML preview. What is wierd is that when I flip back to 22 the problem is still gone :-).

enter image description here

Community
  • 1
  • 1
Jim Andreas
  • 1,557
  • 1
  • 17
  • 29
  • 1
    indeed. And funny as it is, changing to 21 and then back to 22 fixes the problem. That makes no sense at all but it works :D – JRsz Apr 22 '15 at 08:28
  • I updated to the new android studio and still the same stupid error. Why the heck is google not solving such errors? – MBH Jun 19 '15 at 13:15
  • 1
    I can't do this on my IDE, it only presents "API 23: Android 6.0" and has no other options. How can I switch to a different API? – Lou Dec 29 '15 at 00:52
  • 1
    I'm on version 1.51 of AS and this problem still occurs. This answer still solves the problem though. – aresz Jan 27 '16 at 00:25
5

I had to change my values/styles.xml to

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Before that change, it was without 'Base'.

(IntelliJ IDEA 2017.2.4)

lucidbrot
  • 5,378
  • 3
  • 39
  • 68
4

I have faced this issue when I introduced additional supporting libraries in my project IntelliJ IDEA

So for me "File" -> "Invalidate Caches...", and select "Invalidate and Restart" option to fix this.

Min2
  • 10,751
  • 2
  • 19
  • 22
1

To use the class ActionBarOverlayLayout you need to include this in the dependencies section of build.gradle file:

compile 'com.android.support:design:24.1.1'

Sync the project once again and then you will find no problem

Amit Upadhyay
  • 7,179
  • 4
  • 43
  • 57
0

I faced this error when I created second activity in my project in the newly updated Android Studio,I solved it simply by copy pasting the whole xml code from first layout to the second and then I just removed the code that's unnecessary.