AAPT: error: 'techport' is incompatible with attribute layout_constraintStart_toEndOf (attr) reference|enum [parent=0]

Viewed 3150

hello everyone, i'm new to programming. I was doing the layout and when starting the emulator I got this error

D:\SkyScanner\app\src\main\res\layout\fragment_main.xml:122: AAPT: error: 'techport' is incompatible with attribute layout_constraintStart_toEndOf (attr) reference|enum [parent=0].

I read on the medium that you need to remove'kotlin-parcelize'
but still it didn't work for me, can someone help me. i have seen im in medium that's I supposed to put , what I should to do?

`'kotlin-parcelize'`      but it doesn't helped me

i have removed, kotlin-extension from my buildGraddle this is my code

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#2A292B">

    <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar_layout"
        app:layout_constraintTop_toTopOf="parent" />


    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintTop_toBottomOf="@id/toolbar">


        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/constrmain"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/news"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="20dp"
                android:layout_marginTop="20dp"
                app:layout_constraintStart_toStartOf="@id/constrmain"
                app:layout_constraintTop_toTopOf="parent">

                <TextView
                    android:id="@+id/textNews"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/gilroy_bold"
                    android:text="NEWS"
                    android:textColor="@color/colorWhite"
                    android:textSize="24sp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent" />

            </androidx.constraintlayout.widget.ConstraintLayout>

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/recyclerConstr"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/news">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/recyclerMain"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="20dp"
                    android:orientation="horizontal"
                    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:listitem="@layout/main_recycleritem" />

            </androidx.constraintlayout.widget.ConstraintLayout>

            <TextView
                android:id="@+id/textcategory"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="20dp"
                android:layout_marginTop="20dp"
                android:fontFamily="@font/gilroy_bold"
                android:text="CATEGORY"
                android:textColor="@color/colorWhite"
                android:textSize="24sp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/recyclerConstr" />

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/constrTwoItems"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="20dp"
                android:layout_marginTop="20dp"
                app:layout_constraintTop_toBottomOf="@id/textcategory">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:id="@+id/techport"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:layout_constraintEnd_toStartOf="@id/constrMars"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent">

                   

</androidx.constraintlayout.widget.ConstraintLayout>
2 Answers

Just had a similar error to yours, solved it by not constraining the NestedScrollView to the include.

Go through all your constraint Layouts, and check if the declared Attributes are right. One of my TextViews had the "layout_constraintEnd_toEndOf" = 0. I set it on parent and it worked again!

Related