How to use companion objects on xml layout? : <p>I am trying to use a companion object property inside the layout but the compiler doesn't recognise it.</p>

<p><strong>Kotlin Class</strong></p>

<pre><code>class MyClass {
  companion object {
    val SomeProperty = "hey"
  }
}
</code></pre>

<p><strong>XML Layout</strong></p>

<pre><code>&lt;layout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:fancy="http://schemas.android.com/tools"&gt;

  &lt;data&gt;
    &lt;import type="package.MyClass"/&gt;
  &lt;/data&gt;

  &lt;TextView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:text="@{MyClass.Companion.SomeProperty}"/&gt;

&lt;/layout&gt;
</code></pre>

<p>And I got this error:</p>

<pre><code>e: java.lang.IllegalStateException: failed to analyze: android.databinding.tool.util.LoggedErrorException: Found data binding errors.
****/ data binding error ****msg:Could not find accessor package.MyClass.Companion.SomeProperty file:/path/to/my/layout.xml loc:21:67 - 21:103 ****\ data binding error ****

    at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:138)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
    ...
Caused by: android.databinding.tool.util.LoggedErrorException: Found data binding errors.
****/ data binding error ****msg:Could not find accessor package.MyClass.Companion.SomeProperty file:/path/to/my/layout.xml loc:21:67 - 21:103 ****\ data binding error ****

    at android.databinding.tool.processing.Scope.assertNoError(Scope.java:112)
    at android.databinding.annotationprocessor.ProcessDataBinding.doProcess(ProcessDataBinding.java:101)
    at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:65)
    ...
</code></pre>

<p>I've tried to use <code>companion</code> instead of <code>Companion</code>, but no luck.</p>

<p>Is it possible to use companion objects on xml layout with databinding? How can I proceed? Thanks in advance for any help :)</p>
