# Kotlin and Android Development featuring Jetpack:Page 44, Can't build project

**URL:** <https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056>\
**Category:** PragProg Customers\
**Tags:** book-kotlin-and-android-development-featuring-jetpack, question\
**Created:** [4 September 2022 02:17 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056 "2022-09-04T02:17:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NaplesDave](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/n/ecccb3/32.png) [@NaplesDave](https://forum.devtalk.com/u/NaplesDave)\
**Post date:** [4 September 2022 02:17 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056/1 "2022-09-04T02:17:42Z")

</div>

@mfazio23  
I am following along and I have gotten up to adding the data binding items. The project has built alright until I added the data binding stuff. I have compared the Chapter 2 solution code to mine and I can’t find any issues but Mine will not build. I get the following error:

> Android resource linking failed  
> com.example.pennydrop.app-mergeDebugResources-46:/layout/player\_list\_item.xml:52: error: ‘@{switchHidden ? View.INVISIBLE : View.VISIBLE’ is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].  
> error: failed linking file resources.

Can you give me some pointer as to where I might look to fix this error?

PS. When I do the suggested updates (gradle) to the chapter 2 solution code that Android Studio tells me I should do, it fails and won’t build as well. Just a FYI. I’m using Chipmunk.

> Android Studio Chipmunk | 2021.2.1 Patch 2  
> Build #AI-212.5712.43.2112.8815526, built on July 10, 2022  
> Runtime version: 11.0.12+0-b1504.28-7817840 x86\_64  
> VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.  
> macOS 12.5.1  
> GC: G1 Young Generation, G1 Old Generation  
> Memory: 2048M  
> Cores: 16  
> Registry: external.system.auto.import.disabled=true  
> Non-Bundled Plugins: org.intellij.plugins.markdown (212.5457.16), com.thoughtworks.gauge (212.4746.52), com.kite.intellij (1.9.4), org.jetbrains.kotlin (212-1.7.10-release-333-AS5457.46), Dart (212.5744), io.flutter (69.0.2)

---

<div class="post-metadata">

**Author:** ![NaplesDave](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/n/ecccb3/32.png) [@NaplesDave](https://forum.devtalk.com/u/NaplesDave)\
**Post date:** [4 September 2022 18:26 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056/2 "2022-09-04T18:26:07Z")

</div>

I forgot to add the “BUILD OUTPUT” for additional info.  
This may help. I have done some internet research and it seems that there may be a bug in this gradle release, at this point, since I am not some sort of ANDROID or KOTLIN or GRADLE GURU I think I am going to try to REVERT my versions BACKWARDS to the Authors versions so I can continue through the chapter. I don’t see that the author has used any techniques that would cause any issues but there are issue non the less. Here is the Build Output;

````auto
failed
:app:processDebugResources
Android resource linking failed
Android resource linking failed```

And;

````

Android resource linking failed  
com.example.pennydrop.app-mergeDebugResources-46:/layout/player\_list\_item.xml:52: error: ‘@{switchHidden ? View.INVISIBLE : View.VISIBLE’ is incompatible with attribute visibility (attr) enum [gone=2, invisible=1, visible=0].  
error: failed linking file resources.

```auto

```

---

<div class="post-metadata">

**Author:** ![mfazio23](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mfazio23/32/528_2.png) [@mfazio23](https://forum.devtalk.com/u/mfazio23)\
**Post date:** [4 September 2022 20:49 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056/3 "2022-09-04T20:49:01Z")

</div>

Dave,  
Do you mind sharing the code you have in `player_list_item.xml`? It’s really weird that it isn’t recognizing that value, but there could indeed be an issue with Gradle or the binding library.

---

<div class="post-metadata">

**Author:** ![NaplesDave](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/n/ecccb3/32.png) [@NaplesDave](https://forum.devtalk.com/u/NaplesDave)\
**Post date:** [4 September 2022 22:01 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056/4 "2022-09-04T22:01:19Z")

</div>

No Problem, here you are;

```auto
<?xml version="1.0" encoding="utf-8"?>

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

    <data>
        <import type="android.view.View" />

        <variable
            name="checkboxHidden"
            type="Boolean" />

        <variable
            name="switchHidden"
            type="Boolean" />

    </data>

<androidx.constraintlayout.widget.ConstraintLayout

    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <CheckBox
        android:id="@+id/checkbox_player_active"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="@id/edit_text_player_name"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@id/edit_text_player_name"
        android:visibility="@{checkboxHidden ? View.INVISIBLE : View.VISIBLE"/>

    <EditText
        android:id="@+id/edit_text_player_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:hint="@string/player_name"
        android:inputType="textPersonName"
        app:layout_constraintEnd_toStartOf="@id/switch_player_type"
        app:layout_constraintStart_toEndOf="@id/checkbox_player_active"
        app:layout_constraintTop_toTopOf="parent"
        tools:ignore="TouchTargetSizeCheck" />

    <androidx.appcompat.widget.SwitchCompat
        android:id="@+id/switch_player_type"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="@id/edit_text_player_name"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/edit_text_player_name"
        android:visibility="@{switchHidden ? View.INVISIBLE : View.VISIBLE"/>

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>

```

---

<div class="post-metadata">

**Author:** ![mfazio23](https://forum.devtalk.com/user_avatar/forum.devtalk.com/mfazio23/32/528_2.png) [@mfazio23](https://forum.devtalk.com/u/mfazio23)\
**Post date:** [12 September 2022 21:44 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056/5 "2022-09-12T21:44:33Z")

</div>

@NaplesDave - Apologies for the late reply here, took me a bit to get back to this.

Quick answer: you’re missing a curly bracket at the end of the `android:visibility` property on your `SwitchCompat` component.

```xml
android:visibility="@{switchHidden ? View.INVISIBLE : View.VISIBLE"/>

```

Give that a run and see if you’re good (if you didn’t already find this)

---

<div class="post-metadata">

**Author:** ![NaplesDave](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/n/ecccb3/32.png) [@NaplesDave](https://forum.devtalk.com/u/NaplesDave)\
**Post date:** [13 September 2022 01:17 UTC](https://forum.devtalk.com/t/kotlin-and-android-development-featuring-jetpack-page-44-cant-build-project/72056/6 "2022-09-13T01:17:01Z")

</div>

@mfazio23 Thank you very much. Good catch!  
Onward and forward.
