8

Below is my xml where its giving me a warning.

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        android:tag="xlarge">

        .......

    </RelativeLayout>

</Layout>

Dont know what is the issue? and where its showing me that warning. But would love any help how it can be resolved. Tried searching for it on internet but couldn't find anything helpful.

Below is the warning that i am getting...

ERROR: View field thirdPartyLayout collides with a variable or import
2
  • What is the warning? Commented Dec 16, 2019 at 17:17
  • Hi, updated my question.. added warning
    – Darpal
    Commented Dec 16, 2019 at 17:30

2 Answers 2

18

This could happen if your variable name conflicts with an ID tag, for example:

<?xml version="1.0" encoding="utf-8"?>
<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="thirdPartyLayout"
            type="String" />
    </data>

    <TextView
        android:id="@+id/thirdPartyLayout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</layout>

Resolution: rename one of them.

1
  • Thanks! This advice solved my problem from another topic. This real problem is reported while running gradle task :app:kaptDebugKotlin. However this important ERROR: View field NAME collides with a variable or import is report as warning . If we miss this message, we may get another error (e.g. Cannot find symbol DataBindingComponent) on :app:compileDebugJavaWithJavac stage.
    – kenjiuno
    Commented Jan 6, 2022 at 8:28
0

This is not the issue with your layout. It has something to do with thirdPartyLayout. Kindly check link. Let me know if it helps you.

1
  • well thanks for the link, the issue is similar but havent yet figured out what was wrong with my issue. But thanks for sending me atleast gave me an idea.
    – Darpal
    Commented Dec 17, 2019 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.