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 #52

Open sushwanth opened 1 year ago

sushwanth 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#5

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

In which task and step of the codelab can this issue be found? While Creating singleton object of MarsApi with below code

object MarsApi { val retrofitService : MarsApiService by lazy { retrofit.create(MarsApiService::class.java) } }

Describe the problem Errors while using the prompted code, couldnot create regular object as well as retrofit is not accessible in MarsApi singleton object and also unable to pass it as parameter. The Solution code given at the end of codelab has entirely different code structure

Steps to reproduce?

Screenshot 2023-04-18 at 8 53 58 AM
  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.

fe60 commented 1 year ago

You got the file creation step wrong.

Implement the above steps:

  • ...
  • Create a new Kotlin file under the new package. Name it MarsApiService.
  • ...

Create a new Kotlin file ... Your screenshot shows a Kotlin class