13
votes

XML Android: "est en conflit avec une autre balise ayant le même ID"

J'ai récemment supprimé un fragment, y compris sa mise en page et son modèle de vue de mon projet. (FragmentAddFlight, VmAddFlight, fragment_add_flight.xml)

Étonnamment, j'obtiens ces erreurs:

    [databinding] {"msg":"\u003cImageView id\u003d\u0027@+id/imageView2\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":277,"col0":20,"line1":286,"col1":85}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView4\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":308,"col0":28,"line1":312,"col1":64}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/editText8\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":314,"col0":28,"line1":318,"col1":60}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView5\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":327,"col0":28,"line1":331,"col1":63}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView14\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":333,"col0":28,"line1":338,"col1":57}]}
  [databinding] {"msg":"\u003cImageView id\u003d\u0027@+id/imageView2\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":369,"col0":20,"line1":378,"col1":72}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView4\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":400,"col0":28,"line1":404,"col1":60}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/editText8\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":406,"col0":28,"line1":410,"col1":60}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView5\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":419,"col0":28,"line1":423,"col1":71}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView14\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":425,"col0":28,"line1":430,"col1":57}]}
  [databinding] {"msg":"\u003cImageView id\u003d\u0027@+id/imageView2\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":452,"col0":20,"line1":461,"col1":77}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView4\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":483,"col0":28,"line1":487,"col1":60}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/editText8\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":489,"col0":28,"line1":493,"col1":60}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView5\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":502,"col0":28,"line1":506,"col1":71}]}
  [databinding] {"msg":"\u003cTextView id\u003d\u0027@+id/textView14\u0027\u003e conflicts with another tag that has the same ID","file":"C:\\Users\\Christoph\\Documents\\Android-Projekte\\FlightLogger\\app\\src\\main\\res\\layout\\fragment_add_flight.xml","pos":[{"line0":508,"col0":28,"line1":513,"col1":57}]}

N'oubliez pas que le fichier référencé dans ces erreurs a déjà été supprimé. Pourquoi ai-je ces erreurs?

J'ai nettoyé le projet via Build -> clean project. J'ai essayé de reconstruire le projet via le même menu. Mais le résultat reste le même.

Quelqu'un a-t-il une idée de la façon de résoudre ce problème?


1 commentaires

Avez-vous résolu ce problème?


5 Réponses :


40
votes

Ces fichiers sont créés au moment de la compilation, ils n'ont donc peut-être pas été supprimés, essayez d'invalider les caches et redémarrez dans Android Studio.


0 commentaires

3
votes

Pour ajouter comment invalider les caches, dans Android Studio, accédez à Fichier> Invalidate Caches / Restart> Invalidate and Restart


0 commentaires

2
votes

Invalidate Caches/Restart option Invalidate Caches/Restart ne fonctionne pas toujours.

gradlew assembleDebug

Essayez simplement cette commande, puis voyez que le problème ne sera plus disponible.


0 commentaires

0
votes

Problèmes de compilation: Corrigé: 1.Nettoyez le projet. 2. effacez le cache et redémarrez.

Assurez-vous que la liaison de vue est activée.


0 commentaires

0
votes

Si vous utilisez la liaison de vue, vous pouvez l'ajouter à la mise en page jusqu'à ce que vous ayez de meilleurs ID pour les vues:

tools:viewBindingIgnore="true"

Faites-le pour chaque mise en page problématique.

J'ai trouvé cette astuce d'ici:

https://proandroiddev.com/new-in-android-viewbindings-the-difference-from-databinding-library-bef5945baf5e


0 commentaires