java.util.concurrent.TimeoutException: Preview timed out while rendering the layout. This typically happens when there is an infinite loop or unbounded recursion in one of the custom views.


Samebug tips

Try to use Base.Theme.AppCompat.Light.DarkActionBar. It seems sometimes it need the "Base" prefix to work properly. If that doesn't work, go for Build > Rebuild Project and File > Invalidate caches/Restart.


5 months ago
Expert tip

Solutions on the web

Solution icon of stackoverflow
Preview timed out while rendering the layout. This typically happens when there is an infinite loop or unbounded recursion in one of the custom views.

Solution icon of web
Preview timed out while rendering the layout. This typically happens when there is an infinite loop or unbounded recursion in one of the custom views.

Solution icon of stackoverflow
Preview timed out while rendering the layout. This typically happens when there is an infinite loop or unbounded recursion in one of the custom views.

Stack trace

java.util.concurrent.TimeoutException: Preview timed out while rendering the layout. This typically happens when there is an infinite loop or unbounded recursion in one of the custom views.
	at java.util.zip.ZipFile.read(Native Method)
	at java.util.zip.ZipFile.access$1400(ZipFile.java:60)
	at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:717)
	at java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:419)
	at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
	at com.intellij.openapi.util.io.FileUtilRt.loadBytes(FileUtilRt.java:627)
	at com.intellij.openapi.util.io.FileUtil.loadBytes(FileUtil.java:1604)
	at com.intellij.util.lang.MemoryResource.load(MemoryResource.java:74)
	at com.intellij.util.lang.JarLoader.getResource(JarLoader.java:134)
	at com.intellij.util.lang.ClassPath$ResourceStringLoaderIterator.process(ClassPath.java:342)
	at com.intellij.util.lang.ClassPath$ResourceStringLoaderIterator.process(ClassPath.java:332)
	at com.intellij.util.lang.ClasspathCache.iterateLoaders(ClasspathCache.java:98)
	at com.intellij.util.lang.ClassPath.getResource(ClassPath.java:106)
	at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:220)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:119)
	at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:73)
	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:62)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.jetbrains.android.uipreview.ModuleClassLoader.loadClass(ModuleClassLoader.java:193)
	at android.support.v7.widget.VectorEnabledTintResources.shouldBeUsed(VectorEnabledTintResources.java:41)
	at android.support.v7.widget.TintContextWrapper.shouldWrap(TintContextWrapper.java:84)
	at android.support.v7.widget.TintContextWrapper.wrap(TintContextWrapper.java:45)
	at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:60)
	at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:56)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
	at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:172)
	at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:150)
	at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadClass(LayoutlibCallbackImpl.java:193)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:333)
	at android.view.BridgeInflater.onCreateView(BridgeInflater.java:152)
	at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
	at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
	at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
	at com.android.layoutlib.bridge.bars.CustomBar.<init>(CustomBar.java:95)
	at com.android.layoutlib.bridge.bars.NavigationBar.<init>(NavigationBar.java:52)
	at com.android.layoutlib.bridge.bars.NavigationBar.<init>(NavigationBar.java:46)
	at com.android.layoutlib.bridge.impl.Layout.createNavBar(Layout.java:281)
	at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:137)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:301)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
	at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
	at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
	at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$70(RenderTask.java:659)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago