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 Pragmatic topics Top

jimmykiang
This test is broken right out of the box… — FAIL: TestAgent (7.82s) agent_test.go:77: Error Trace: agent_test.go:77 agent_test.go:...
New
jon
Some minor things in the paper edition that says “3 2020” on the title page verso, not mentioned in the book’s errata online: p. 186 But...
New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New
roadbike
From page 13: On Python 3.7, you can install the libraries with pip by running these commands inside a Python venv using Visual Studio ...
New

Other popular topics Top

malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
New
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
New
foxtrottwist
A few weeks ago I started using Warp a terminal written in rust. Though in it’s current state of development there are a few caveats (tab...
New
New
PragmaticBookshelf
Author Spotlight: Karl Stolley @karlstolley Logic! Rhetoric! Prag! Wow, what a combination. In this spotlight, we sit down with Karl ...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New

Latest in PragProg

View all threads ❯