I build an app and it was working very well by Kotlin Language. After I added some elements in a specific layout, I found the app doesn't run and I find this error:
And this tags layout page:
<?xml version="1.0" encoding="utf-8"?>
<layout 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"
tools:context="com.albnaapp.empusers.warehouse.AddDepositFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@ id/client_name"
style="@style/TitleTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/str_client_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<AutoCompleteTextView
android:id="@ id/client_code"
style="@style/HintTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="39dp"
android:hint="@string/str_hint_enterTheCode"
android:textColorHint="#757575"
app:layout_constraintEnd_toStartOf="@ id/deposit_amount"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@ id/client_name"
tools:ignore="LabelFor,TouchTargetSizeCheck" />
<EditText
android:id="@ id/deposit_amount"
style="@style/HintTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:ems="10"
android:hint="@string/str_hint_enterTheAmount"
android:inputType="numberDecimal"
android:textColorHint="#757575"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@ id/client_code"
app:layout_constraintTop_toBottomOf="@ id/client_name"
tools:ignore="Autofill,LabelFor,SpeakableTextPresentCheck,TouchTargetSizeCheck" />
<TextView
android:id="@ id/deposit_type"
style="@style/NormalStyle"
android:layout_width="wrap_content"
android:layout_height="@dimen/Space6_48"
android:gravity="center"
android:text="@string/str_deposit_type"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@ id/client_code" />
<RadioGroup
android:id="@ id/details_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="0dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/deposit_type">
<RadioButton
android:id="@ id/type_deposit"
style="@style/NormalStyleLtBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/str_deposit" />
<RadioButton
android:id="@ id/type_cheque"
style="@style/NormalStyleLtBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_cheque" />
<RadioButton
android:id="@ id/type_receipt"
style="@style/NormalStyleLtBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_receipt" />
<RadioButton
android:id="@ id/type_mail"
style="@style/NormalStyleLtBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_mail" />
</RadioGroup>
<TextView
android:id="@ id/more_details"
style="@style/NormalStyle"
android:layout_width="wrap_content"
android:layout_height="@dimen/Space6_48"
android:gravity="center"
android:text="@string/str_more_details"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@ id/details_group" />
<RadioGroup
android:id="@ id/more_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@ id/more_details">
<RadioButton
android:id="@ id/is_for_me"
style="@style/NormalStyleLtBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_forMe" />
<RadioButton
android:id="@ id/isn't_for_me"
style="@style/NormalStyleLtBlue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_forOthers" />
</RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Please help me to solve this problem. As I don't know where the problem and I don't know how to solve it. And if you need more details, don't hesitate to tell me.
CodePudding user response:
I think the apostrophe in the radio button id is an issue.
android:id="@ id/isn't_for_me"
is not a valid id.
Go with something like this instead
android:id="@ id/is_not_for_me"