google-developer-training / basic-android-kotlin-compose-training-mars-photos

Solution code for Android Basics in Kotlin course
https://developer.android.com/courses/android-basics-kotlin/course?gclid=CjwKCAjw4c-ZBhAEEiwAZ105RTyT-iaLHzrhMBUXdMhO230ZDwOwxxI2x4RgK8DwBxK8t1h0wmU_QxoCi4YQAvD_BwE
Apache License 2.0
66 stars 58 forks source link

Get Data from the Internet #10

Closed ShayDeeJay closed 1 year ago

ShayDeeJay commented 1 year ago

URL of codelab: https://developer.android.com/codelabs/basic-android-kotlin-compose-getting-data-internet?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-5-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-getting-data-internet#7

Specify the language of the codelab if it is not English:

In which task and step of the codelab can this issue be found? in the section you change the library import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory import kotlinx.serialization.json.Json import okhttp3.MediaType

private val retrofit = Retrofit.Builder() .addConverterFactory(Json.asConverterFactory("application/json".toMediaType())) .baseUrl(BASE_URL) .build()

Describe the problem in the codelab the line is as follows

".addConverterFactory(Json.asConverterFactory("application/json".toMediaType()))"

this highlights an error as this is not the correct format, this part is also not mentioned at all in the codelab.

the correct format is in the solutioncode posted.

".addConverterFactory(Json.asConverterFactory(MediaType.get("application/json")))"

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions Android Studio version: API version of the emulator:

Additional information Include screenshots if they would be useful in clarifying the problem.

osuleymanova commented 1 year ago

Hello @shadyeejay,

Thank you for reaching out to us and reporting this issue. The code block is updated:

Screenshot 2023-01-04 at 8 46 32 AM