Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio ConstraintLayout alpha 9 onMeasure error

Tags:

android

layout

im using ConstraintLayout alpha 9 to build my layout when i was on alpha 8 its says obsolete layout but when i updated to alpha 9 i gen onMeasure error this is the error code

java.lang.NoSuchMethodError: android.support.constraint.solver.widgets.ConstraintWidget.setHorizontalWeight(F)V
at android.support.constraint.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:675)
at android.support.constraint.ConstraintLayout.updateHierarchy(ConstraintLayout.java:468)
at android.support.constraint.ConstraintLayout.onMeasure_Original(ConstraintLayout.java:770)
at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java)
at android.view.View.measure(View.java:19731)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.support.v7.widget.ContentFrameLayout.onMeasure_Original(ContentFrameLayout.java:135)
at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java)
at android.view.View.measure(View.java:19731)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6120)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure_Original(ActionBarOverlayLayout.java:391)
at android.support.v7.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java)
at android.view.View.measure(View.java:19731)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:19731)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.measureView(RenderSessionImpl.java:545)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:342)
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$72(RenderTask.java:659)
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)

any solution

like image 297
Ahmed Nageeb Avatar asked Oct 06 '16 14:10

Ahmed Nageeb


1 Answers

Due to API change, you might have to restart Android Studio 2.2 after upgrading to alpha 8 for layout preview to work.

please refer this

Solution

Do Invalidate Caches and restart

To do this go to

File->Invalidate Caches / Restart->Invalidate and Restart.

Credits: ConstraintLayout does not render correctly outside blueprint mode

like image 175
Kiran Benny Joseph Avatar answered Sep 27 '22 20:09

Kiran Benny Joseph