Skip to content Skip to sidebar Skip to footer

Exception Raised During Rendering: Unable To Find The Layout For Action Bar

While using Android Studio just now I was editing an XML file in the editor and I got this error in the Preview and Design windows: Exception raised during rendering: Unable to fi

Solution 1:

I had this kind of error. On My Mac, there is API 22. If I choose it this error will appear. So clicking on API 21 or below would solve your problem

enter image description here

You probably need to update your tools

Solution 2:

Those using Eclipse might try to choose Theme.DeviceDefault to eliminate the exception. Update: as per comments this works for Android Studio also. enter image description here

Solution 3:

You can solve this problem by two ways

Change API from the tab, Try one of them from the available or Select PICK UP BEST or change your minimum sdk

Select API from the available

Change the Theme if first solution not work

enter image description here

Solution 4:

Solution 5:

I had this error on eclipse-3.8, adt-23.07, sdk-tools-23.1, appcompat_v7_r19.1.

After analyzing the error I found the problem is in android-sdk-linux/platforms/android-23/data/layoutlib.jar:com/android/layoutlib/bridge/impl/Layout.class on method createActionBar at line if (this.mBuilder.isThemeAppCompat())

My solution:

  1. (don't have the source, so) decompile Layout.class -> Layout.java
  2. edit Layout.java, add method:
private boolean hasWindowDecorActionBar(SessionParams params) {
        LayoutlibCallback callback = params.getLayoutlibCallback();
        try {
            callback.findClass("android.support.v7.app.WindowDecorActionBar");
        } catch (ClassNotFoundException ei) {
            try {
                callback.findClass("android.support.v7.internal.app.WindowDecorActionBar");
            } catch (ClassNotFoundException e) {
                returnfalse;
            }
        }
        returntrue;
    }

  1. Locate the line if (this.mBuilder.isThemeAppCompat()) then change to :

    if (this.mBuilder.isThemeAppCompat() && hasWindowDecorActionBar(params))

  1. recompile Layout.java -> Layout.class and Layout$Builder.class
  2. update layoutlib.jar with the new classes
  3. restart eclipse

That's all. Now, I can render using API-23 all of my old app layouts that links against appcompat_v7_r19.1.

Post a Comment for "Exception Raised During Rendering: Unable To Find The Layout For Action Bar"