NaplesDave

NaplesDave

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

@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)

Marked As Solved

mfazio23

mfazio23

Author of Kotlin and Android Development featuring Jetpack

@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.

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

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

Also Liked

NaplesDave

NaplesDave

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

Where Next?

Popular Pragmatic Bookshelf topics Top

simonpeter
When I try the command to create a pair of migration files I get an error. user=> (create-migration "guestbook") Execution error (Ill...
New
Chrichton
Dear Sophie. I tried to do the “Authorization” exercise and have two questions: When trying to plug in an email-service, I found the ...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
adamwoolhether
Is there any place where we can discuss the solutions to some of the exercises? I can figure most of them out, but am having trouble with...
New
taguniversalmachine
Hi, I am getting an error I cannot figure out on my test. I have what I think is the exact code from the book, other than I changed “us...
New
kolossal
Hi, I need some help, I’m new to rust and was learning through your book. but I got stuck at the last stage of distribution. Whenever I t...
New
EdBorn
Title: Agile Web Development with Rails 7: (page 70) I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision...
New
davetron5000
Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
New
dachristenson
I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New
dachristenson
I’ve got to the end of Ch. 11, and the app runs, with all tabs displaying what they should – at first. After switching around between St...
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
Or looking forward to? :nerd_face:
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Sub Categories: