Hỏi cách sửa lỗi Render problem trong android studio

Em thử chạy đoạn code đơn giản nhưng nó cứ hiện lỗi Render problem ạ. Em dùng bản 4.1.3

image
Đây là stack khi copy ra ạ

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
	at java.util.ArrayList.get(ArrayList.java:433)
	at com.android.ninepatch.NinePatchChunk.draw(NinePatchChunk.java:190)
	at com.android.ninepatch.NinePatchChunk.draw(NinePatchChunk.java:106)
	at android.graphics.BaseCanvas_Delegate$1.draw(BaseCanvas_Delegate.java:464)
	at com.android.layoutlib.bridge.impl.GcSnapshot.drawInLayer(GcSnapshot.java:697)
	at com.android.layoutlib.bridge.impl.GcSnapshot.draw(GcSnapshot.java:587)
	at android.graphics.BaseCanvas_Delegate.nDrawNinePatch(BaseCanvas_Delegate.java:461)
	at android.graphics.BaseCanvas.nDrawNinePatch(BaseCanvas.java)
	at android.graphics.BaseCanvas.drawPatch(BaseCanvas.java:307)
	at android.graphics.Canvas.drawPatch(Canvas.java:1825)
	at android.graphics.NinePatch.draw(NinePatch.java:217)
	at android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:249)
	at android.graphics.drawable.DrawableContainer.draw(DrawableContainer.java:87)
	at android.graphics.drawable.DrawableWrapper.draw(DrawableWrapper.java:240)
	at android.view.View.drawBackground(View.java:21671)
	at android.view.View.draw_Original(View.java:21435)
	at android.view.View_Delegate.draw(View_Delegate.java:56)
	at android.view.View.draw(View.java:21417)
	at android.view.View.draw_Original(View.java:21317)
	at android.view.View_Delegate.draw(View_Delegate.java:68)
	at android.view.View.draw(View.java:21089)
	at android.view.ViewGroup.drawChild_Original(ViewGroup.java:4388)
	at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:65)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
	at android.view.View.draw_Original(View.java:21315)
	at android.view.View_Delegate.draw(View_Delegate.java:68)
	at android.view.View.draw(View.java:21089)
	at android.view.ViewGroup.drawChild_Original(ViewGroup.java:4388)
	at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:65)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at android.view.View.draw_Original(View.java:21315)
	at android.view.View_Delegate.draw(View_Delegate.java:68)
	at android.view.View.draw(View.java:21089)
	at android.view.ViewGroup.drawChild_Original(ViewGroup.java:4388)
	at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:65)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at android.view.View.draw_Original(View.java:21315)
	at android.view.View_Delegate.draw(View_Delegate.java:68)
	at android.view.View.draw(View.java:21089)
	at android.view.ViewGroup.drawChild_Original(ViewGroup.java:4388)
	at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:65)
	at android.view.ViewGroup.drawChild(ViewGroup.java:4388)
	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149)
	at android.view.View.draw_Original(View.java:21446)
	at android.view.View_Delegate.draw(View_Delegate.java:56)
	at android.view.View.draw(View.java:21417)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:404)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.renderAndBuildResult(RenderSessionImpl.java:565)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:425)
	at com.android.layoutlib.bridge.BridgeRenderSession.render(BridgeRenderSession.java:115)
	at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:143)
	at com.android.ide.common.rendering.api.RenderSession.render(RenderSession.java:125)
	at com.android.tools.idea.rendering.RenderTask.lambda$null$11(RenderTask.java:966)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

kệ đi, nhiều khi android studio bị hâm nên thế đấy

4 Likes

Bạn có thử gỡ ra cài lại miếng nào chưa

Mình gỡ ra cài lại 2 lần r bạn ơi

Ờ, chỉnh phiên bản gì đấy. Mình không rõ.

Nếu không phải (và không được). Hãy thêm thuộc tính background cho EditText.

2 Likes

Bạn thử update version của constraintlayout lên mới nhất xem thế nào, mình cũng bị vậy sau khi update thì ko thấy lỗi nữa.
‘androidx.constraintlayout:constraintlayout:2.2.0-alpha05’

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?