piotrpo
piotrpo

Reputation: 12636

Android Studio shows errors in layout.xml

I'm using data binding library and I experience following issues in Android Studio 3.0:

somelayout.xml:

<layout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools">

    <data>
        <variable
            name="meeting"
            type="some.package.MeetingStatusResponse"/>
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{meeting.title}"
            tools:text="Title"
            />


            ...


    </LinearLayout>
</layout>

In this place: android:text="@{meeting.title}" Android Studio 3.0 underlines the @ symbol and informs about error:

Error:(29, 27) <expr> or <lambda expression> expected, got '@'

Model class is written in Kotlin if it has any relevance. The code completion is also not working for bound classes. The application can be successfully build using both, gradle command and Android Studio run app button. So this is just editor issue.

I observe this issue on Mac. On Windows it works ok. I do not have more computers to check if it's platform related issue.

Upvotes: 2

Views: 1300

Answers (1)

Olena Y
Olena Y

Reputation: 233

Maybe you forgot to add in gradle compileOptions ?

    `sourceCompatibility JavaVersion.VERSION_1_7`
    `targetCompatibility JavaVersion.VERSION_1_7`

Upvotes: 1

Related Questions