Errata for Real-World Android by Tutorials, 1st Edition

Creating this topic to catch any typos and bugs in the 1st Edition of Real-World Android by Tutorials.

In the Building Features – Animals Near You section, the starter project has an older version of Hilt than the finished project. This caused issues with the project unable to resolve the HiltViewModel dependency.

1 Like

In section 2,
10.6 - Handling dependency injection

The DaggerSharingComponent file does not appear in the book.

DaggerSharingComponent.builder ()
.context (requireActivity ())
.moduleDependencies (
EntryPointAccessors.fromApplication (
requireActivity (). applicationContext,
SharingModuleDependencies ::
.build ()
.inject (this)

  • 13.Custom Views

Understanding the Canvas coordinate system

Figure 13.2 — Android Canvas Coordinates System

In Figure 11.2, you can see that an (x,y) pair represents each…

The correct thing would be: In Figure 13.2, you can see that an (x,y) pair represents each…

For chapter 5, this isn’t really an issue with the book but with the starter code. Once I finished completing the chapter my test wouldn’t pass… I was racking my brain until I realized the fake server couldn’t find the asset file.

I have to make sure my file had the sourceSets object setup pointing to the right directory.

Just FYI

1 Like

This is an issue with the book, since chapter 5 makes no mention of the need to set the sourceSets in the file. Thankfully you posted here, otherwise I would have also been wracking my brain trying to figure out why my tests were timing out :frowning:

That’s generated by Dagger when annotating with @Component.Builder

@Component(dependencies =[SharingModuleDependencies::class])
interface SharingComponent {
fun inject(fragment: SharingFragment)

interface Builder {
    fun context(@BindsInstance context: Context): Builder
    fun moduleDependencies(sharingModuleDependencies: SharingModuleDependencies): Builder
    fun build(): SharingComponent


Chapter 13 - Custom Views - In topic " Binding the animation to the adopt button", the following is not part of the starter code, and is also not mentioned at any point of the chapter:

binding.adoptButton.setOnClickListener {
      viewModel.handleEvent(AnimalDetailsEvent.AdoptAnimal) //

The Event Adopt Animal is not defined. Also this function is missing in the start project

private fun adoptAnimal() {
        Observable.timer(2L, TimeUnit.SECONDS)
            .subscribe {
              _state.value = (_state.value as AnimalDetailsViewState.AnimalDetails?)?.copy(adopted = true)

,thank you so much :handshake:,

(Arctic Fox 2020.3.1 patch 4)
I have the project for chapter 11 configured as follows for Gradle at the project and app levels:

  • Project level:

  • app level:

:kissing_heart: :kissing_heart: :kissing_heart:

In the last of chapter 16: Conceal library at: GitHub - facebookarchive/conceal: Conceal provides easy Android APIs for performing fast encryption and authentication of data.. That’s True or false?

Been trying to test my network to no avail.I’m at chapter 4.

1 Like

Prior to Style and Themes the book uses coroutines.However in Style and Themes.The writer of that section uses RxJava.
So yeah the function adoptAnimal you posted is an RxJava code which replaces the coroutine code.The write of that section may have preferred to use it as each section is independent. Also if you decide to make a change it is gonna affect your entire code.So here is a simple workaround I did if you writing the full app and want to maintain the coroutine code.

private fun adoptAnimal() {
viewModelScope.launch {
try {
val adopt = withContext({}
_state.value = (_state.value as AnimalsDetailsViewState.AnimalDetails?)?.copy(adopted = true)
}catch (t:Throwable){

hope this helped you out.

This topic was automatically closed after 5 hours. New replies are no longer allowed.