dachristenson

dachristenson

Kotlin and Android Development featuring Jetpack: Should app build by end of p. 294?

@mfazio23

My version of the app was building (version as of p. 284), but as of the end of p. 294, it fails to build with this error:

e: file:///D:/home/Derek/Dropbox/AndroidStudioProjects/AndroidBaseballLeague/app/src/main/java/com/example/abl/settings/SettingsFragment.kt:100:15 Unresolved reference: attr

When I look at that, Android Studio complains that the attribute colorPrimary is undefined. As far as I can tell, my theme files are almost identical to those in the provided code for Ch. 12, and colorPrimary is, indeed, defined for both day and night themes. So, why is it hanging up here and refusing to build? Am I missing something that is mentioned later in Ch. 12?

Also, Android Studio is giving me a warning about onBindPreferences, saying

PreferenceFragmentCompat.onBindPreferences can only be called from within the same library group prefix (referenced groupId=androidx.preference with prefix androidx from groupId=Android Baseball League)

That warning, however, does not seem to be preventing the build.

Marked As Solved

mfazio23

mfazio23

Author of Kotlin and Android Development featuring Jetpack

This one’s weird as I’m not sure what differs between your project and what I have set up. I’m assuming it’s something with the updated library versions, but I’m honestly not sure (and yes, I’m seeing the same thing on my version of your code).

That being said, an easy fix is to change the attribute reference to android.R.attr.colorPrimary. It’ll pull in the <item name="colorPrimary">@color/androidGreen</item> attribute from your themes all the same.

Popular Prag Prog topics Top

Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
New
jesse050717
Title: Web Development with Clojure, Third Edition, pg 116 Hi - I just started chapter 5 and I am stuck on page 116 while trying to star...
New
JohnS
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps. With: ruby-3.0.0 s...
New
HarryDeveloper
Hi @venkats, It has been mentioned in the description of ‘Supervisory Job’ title that 2 things as mentioned below result in the same eff...
New
New
jskubick
I think I might have found a problem involving SwitchCompat, thumbTint, and trackTint. As entered, the SwitchCompat changes color to hol...
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
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
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
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
PragmaticBookshelf
A PragProg Hero’s Journey with Brian P. Hogan @bphogan Have you ever worried that your only legacy will be in the form of legacy...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
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
PragmaticBookshelf
Rails 7 completely redefines what it means to produce fantastic user experiences and provides a way to achieve all the benefits of single...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
New
AstonJ
Chris Seaton, the creator of TruffleRuby has died. It appears from suicide :cry: He left this note on Twitter on the weekend: And one...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Latest in PragProg

View all threads ❯