preview in Android Studio doesn't work. Tried to change API, but without results.
Exception raised during rendering: 16 (Details)
java.lang.ArrayIndexOutOfBoundsException: 16
at android.text.StaticLayout.generate(StaticLayout.java:854)
at android.text.StaticLayout.<init>(StaticLayout.java:603)
at android.text.StaticLayout.<init>(StaticLayout.java:50)
at android.text.StaticLayout$Builder.build(StaticLayout.java:425)
at android.widget.TextView.makeNewLayout(TextView.java:8272)
at android.widget.TextView.assumeLayout(TextView.java:8104)
at android.widget.TextView.onPreDraw(TextView.java:6742)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
at android.view.AttachInfo_Accessor.dispatchOnPreDraw(AttachInfo_Accessor.java:46)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:404)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:543)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:426)
at com.android.layoutlib.bridge.BridgeRenderSession.render(BridgeRenderSession.java:108)
at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:154)
at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:136)
at com.android.tools.idea.rendering.RenderTask.lambda$renderInner$5(RenderTask.java:671)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
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)
I had the same issue in my custom view with TextInputEditText
field (btw it was com.google.android.material.textfield.TextInputEditText
).
There was problem with android:hint="@string/long_hint_descr"
. You removed a couple of words from string.xml
for long_hint_descr
and error was gone.
But easiest way is to add tools:hint="short hint"
with short string and keep original long in strings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With