antoniolg / Kotlin-for-Android-Developers

Companion App for the book

Home Page:http://antonioleiva.com/kotlin-android-developers/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error

LiviuSo opened this issue · comments

val daily = dailyForecast.map { convertDayFromDomain(id, it) }

Where does the id come from?

It comes from the forecastList that is passed to with:

data class ForecastList(val id: Long, val city: String, val country: String,

Got it! My bad, sorry! Many thanks!

I'm in Android Studio 3.01... the program can't seem to find RecyclerView

Even copying and pasting the code from the git returns that RecyclerView cannot be found, and if you type import.android.support.v7.widget.RecyclerView, it doesn't autocomplete, nothing even close under widget... was it removed by chance?
Oddly, adding a RecyclerView to activity_main.xml works fine...

Ok... anybody who gets this problem, add the following to your build gradle (the app one):
implementation 'com.android.support:recyclerview-v7:26.1.0'
(You might have to change the version to match your current sdk). Once I did that, it worked. Go figure.

Yeah, to use the recyclerview you need to add that support library. It's explained at the beginning of chapter 5:

image

Was that your problem, or did you have to add also that line to make it work? In the past I've found myself having issues to get that library detected, solved by doing several project cleans.

/com.example.user.weatherkotlin E/RecyclerView: No adapter attached; skipping layout
I followed your book step by step till chapter 15, and I tried to run the app on my Nexus 5.
I got an empty screen.
Can you help
Thanks in advance!!