Reputation: 793
I have a problem with Android XML files and I need your help. I have the following code:
<TextView
android:id="@+id/textViewA"
android:layout_width="95dp"
android:layout_height="35dp"
android:text="A"
android:textColor="#000000"
android:textSize="22dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.012"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.671" />
<TextView
android:id="@+id/textViewS"
android:layout_width="95dp"
android:layout_height="35dp"
android:text="S"
android:textColor="#000000"
android:textSize="22dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.012"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.584" />
So basically I have two TextViews. When I compile, I get the error message:
'<TextView id='@+id/textView'> conflicts with another tag that has the same ID'
and when I click at the respective lines of the error, those two TextViews are shown. I do not really understand this because they do not have the same ID. They used to have the same ID but I changed it, still the problem occurs. Maybe this has something to do with ViewBinding that I just enabled? I'd appreciate every comment.
Update: I realized that in fact is has something to do with the ViewBinding because I also can see the following information:
Found data binding error(s):
[databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\T.D\\AndroidStudioProjects\\BarApp\\BarApp_Projekt\\app\\src\\main\\res\\layout\\activity_cocktail_ytest.xml","pos":[{"line0":48,"col0":4,"line1":61,"col1":52}]}
[databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\T.D\\AndroidStudioProjects\\BarApp\\BarApp_Projekt\\app\\src\\main\\res\\layout\\activity_cocktail_ytest.xml","pos":[{"line0":121,"col0":4,"line1":134,"col1":52}]}
But still I do not know the cause of the error. I mean they definetely do not have the same ID.
Upvotes: 0
Views: 2336
Reputation: 174
https://stackoverflow.com/a/68280374/6386888
Delete your project and pull source code from git again. It may can help
Upvotes: 0
Reputation: 403
Invalidate caches and restart android studio will help you.
Upvotes: 3