Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'preview timed out while rendering the layout infinite loop or unbounded recursion' when I duplicated some TableRows

I'm just making an app which will work as an answersheet. I kept TableLayout for containing the various questions in rows and their multiple choices in the columns
So I 'copy-pasted' this TableRow code 11 times for 11 questions

    <TableRow
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:orientation="horizontal">



    <TextView
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="1"
        android:textSize="24sp"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="A"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="B"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="C"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="D"/>
    <CheckBox
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"/>

</TableRow>

But there was rendering error saying 'infinite loop or unbounded recursion'

My activity_main.xml file

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="5"
android:layout_column="5"
android:background="@android:color/holo_blue_dark">

<TableRow
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:orientation="horizontal">



    <TextView
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="1"
        android:textSize="24sp"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="A"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="B"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="C"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="D"/>
    <CheckBox
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"/>

</TableRow>
<TableRow
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:orientation="horizontal">



    <TextView
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="1"
        android:textSize="24sp"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="A"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="B"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="C"/>
    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="D"/>
    <CheckBox
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"/>

</TableRow>



</TableLayout>

I want to create something like this with 11 questions this

here's the 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.ArrayList.indexOf(ArrayList.java:317)
at java.util.ArrayList.contains(ArrayList.java:300)
at com.android.layoutlib.bridge.impl.DelegateManager.addNewDelegate(DelegateManager.java:132)
at android.graphics.drawable.VectorDrawable_Delegate.nCreateTree(VectorDrawable_Delegate.java:94)
at android.graphics.drawable.VectorDrawable.nCreateTree(VectorDrawable.java)
at android.graphics.drawable.VectorDrawable.access$300(VectorDrawable.java:204)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.createNativeTree(VectorDrawable.java:824)
at android.graphics.drawable.VectorDrawable$VectorDrawableState.access$000(VectorDrawable.java:761)
at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:581)
at android.graphics.drawable.DrawableInflater.inflateFromXml(DrawableInflater.java:130)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1224)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1197)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:316)
at android.content.res.Resources_Delegate.getDrawable(Resources_Delegate.java:142)
at android.content.res.Resources.getDrawable(Resources.java:763)
at android.graphics.drawable.AnimatedVectorDrawable.inflate(AnimatedVectorDrawable.java:373)
at android.graphics.drawable.DrawableInflater.inflateFromXml(DrawableInflater.java:130)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1224)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1197)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:316)
at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:687)
at android.graphics.drawable.AnimatedStateListDrawable.parseTransition(AnimatedStateListDrawable.java:473)
at android.graphics.drawable.AnimatedStateListDrawable.inflateChildElements(AnimatedStateListDrawable.java:455)
at android.graphics.drawable.AnimatedStateListDrawable.inflate(AnimatedStateListDrawable.java:385)
at android.graphics.drawable.DrawableInflater.inflateFromXml(DrawableInflater.java:130)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1224)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1197)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:316)
at android.content.res.Resources_Delegate.getDrawable(Resources_Delegate.java:142)
at android.content.res.Resources.getDrawable(Resources.java:763)
at android.support.v7.widget.ResourcesWrapper.getDrawable(ResourcesWrapper.java:133)
at android.content.Context.getDrawable(Context.java:525)
at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:352)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181)
at android.support.v7.widget.AppCompatCompoundButtonHelper.loadFromAttributes(AppCompatCompoundButtonHelper.java:64)
at android.support.v7.widget.AppCompatCheckBox.<init>(AppCompatCheckBox.java:61)
at android.support.v7.widget.AppCompatCheckBox.<init>(AppCompatCheckBox.java:54)
at sun.reflect.GeneratedConstructorAccessor363.newInstance(Unknown Source)
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.loadView(ViewLoader.java:105)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:186)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:312)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:141)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:210)
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.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:317)
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$61(RenderTask.java:659)
at com.android.tools.idea.rendering.RenderTask$$Lambda$141/4860208.call(Unknown Source)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
like image 259
Sushant Baskota Avatar asked Aug 09 '16 02:08

Sushant Baskota


2 Answers

Try this:

Build -> Rebuild Project

This helps me to get rid of this error. I didn't change any of my code.

like image 102
peteroid Avatar answered Oct 06 '22 01:10

peteroid


Going to another layout which does not have this issue, and coming back again to the layout which was facing this issue worked out for me.

like image 29
Reejesh PK Avatar answered Oct 06 '22 01:10

Reejesh PK