Solution 1 :
You are trying to cast LinearLayout to ConstraintLayout. But you can import the corresponding layout in LinearLayout.
E/racticesmartap: [qarth_debug:] get PatchStore::createDisableExceptionQarthFile method fail. E/AndroidRuntime: FATAL EXCEPTION: main Process: com.smartpractice.smartpracticesmartapp, PID: 10481 java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to androidx.constraintlayout.widget.ConstraintLayout$LayoutParams –
Problem :
Hello I am struggling with an error when starting my app here is the error log,
I am trying to add a forground service to the app but removing the code for it does not fix the issue , I have tried a fresh install of the app onmy device, clean project, rebuild project, restarting android studio I seriously dont even know where to begin to solve this error
E/racticesmartap: [qarth_debug:] get PatchStore::createDisableExceptionQarthFile method fail.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.smartpractice.smartpracticesmartapp, PID: 10481
java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to androidx.constraintlayout.widget.ConstraintLayout$LayoutParams
at androidx.constraintlayout.widget.ConstraintLayout.getTargetWidget(ConstraintLayout.java:1144)
at androidx.constraintlayout.widget.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:1021)
at androidx.constraintlayout.widget.ConstraintLayout.updateHierarchy(ConstraintLayout.java:803)
at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1561)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:726)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:726)
at android.view.View.measure(View.java:23454)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:847)
at android.view.View.measure(View.java:23454)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2954)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1753)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2041)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1636)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7946)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092)
at android.view.Choreographer.doCallbacks(Choreographer.java:893)
at android.view.Choreographer.doFrame(Choreographer.java:812)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078)
at android.os.Handler.handleCallback(Handler.java:907)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:216)
at android.app.ActivityThread.main(ActivityThread.java:7625)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I do not know where this error occurs, please help
Comments
Comment posted by Arda Kazancı
You are trying to cast LinearLayout to ConstraintLayout.
Comment posted by Ruben Meiring
@kzncrda Yes, Thank you how must I start looking for the problem in the XML files?
Comment posted by Ruben Meiring
the problem is I am unsure where excatly this is happening
Comment posted by Arda Kazancı
I don’t know your XML Layout. But you can import the corresponding layout in LinearLayout.
Comment posted by Ruben Meiring
thats the problem the logcat does not show WHICH xml is giving the error