7

After updating to Android Studio 1.2.1.1, I created a new fresh blank project and created a layout.xml

Shortly after creation, I decided to look at the preview. I went in and I saw this:

The following classes could not be instantiated: - android.support.v7.internal.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache) Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.NoClassDefFoundError: Could not initialize class android.support.v7.internal.widget.ActionBarOverlayLayout   at java.lang.reflect.Constructor.newInstance(Constructor.java:408)   at android.view.LayoutInflater.inflate(LayoutInflater.java:482)   at android.view.LayoutInflater.inflate(LayoutInflater.java:414)   at com.android.layoutlib.bridge.bars.BridgeActionBar.(BridgeActionBar.java:84)   at com.android.layoutlib.bridge.bars.AppCompatActionBar.(AppCompatActionBar.java:56) Copy stack to clipboard

I have never seen it before and I had never encountered it before. Anyone have any idea how to fix this?

EDIT:

Someone Recommended me this location but it didn't work. It only brought me NullPointerExceptions.

I tried rebuilding the project but it didn't work.

Community
  • 1
  • 1
Fish
  • 1,689
  • 1
  • 18
  • 28
  • possible duplicate of [ERROR :rendering problems The following classes could not be found android.support.v7.internal.widget.ActionBarOverlayLayout](http://stackoverflow.com/questions/29887722/error-rendering-problems-the-following-classes-could-not-be-found-android-suppo) – tachyonflux May 27 '15 at 23:53
  • 1
    Did you try a `clean` and `rebuild`? Restart the IDE? I just updated as well - no problems yet. – DigitalNinja May 28 '15 at 00:02
  • This often happens when the preview is rendered with API 22, change to lower version and you're good.. – Lamorak May 28 '15 at 08:02
  • @Lamorak I an using API 22 on nexus 5 for preview. But when i used the following answer, the error was fixed – Fish May 28 '15 at 10:13

1 Answers1

19

Seems to be a bug. Workaround is to inherit from the Base theme in your styles.xml:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light"/>
tachyonflux
  • 20,103
  • 7
  • 48
  • 67
  • Posted an answer since people don't seem to think this is a duplicate. And since that question doesn't have an accepted answer (just a highly upvoted one...) – tachyonflux May 28 '15 at 01:46
  • You are right but why does the generated "styles.xml" use `parent="Theme.AppCompact.Light"`? Why didn't google fix it in the update – Fish May 28 '15 at 10:56