Giter VIP home page Giter VIP logo

android-basics-kotlin-mars-photos-app's Introduction

MarsPhotos - Solution Code

Solution code for Android Basics in Kotlin.

Introduction

MarsPhotos is a demo app that shows actual images of Mar's surface. These images are real-life photos from Mars captured by NASA's Mars rovers. The data is stored on a Web server as a REST web service. This app demonstrated the use of Retrofit to make REST requests to the web service, Moshi to handle the deserialization of the returned JSON to Kotlin data objects, and Coil to load images by URL.

The app also leverages ViewModel, LiveData, and Data Binding with binding adapters.

Pre-requisites

You need to know:

  • How to create and use fragments.
  • How to use architecture components including ViewModel, and LiveData.
  • How to use coroutines for long-running tasks.

Getting Started

  1. Download and run the app.

android-basics-kotlin-mars-photos-app's People

Contributors

android-dev-lxl avatar osuleymanova avatar owenlarosa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

android-basics-kotlin-mars-photos-app's Issues

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
Task: 6
Step: "Object declarations"
Sub-step: 3

Describe the problem
The text "the caller will access the same a singleton Retrofit object" should read "the caller will access the same singleton Retrofit object".

Include screenshots if they would be useful in clarifying the problem.
Screenshot 2021-04-25 131728

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet#7

In which task and step of the codelab can this issue be found?
Structure of sample JSON response:

Describe the problem
In the sentence: "Each JSON object contains a set of name-value pairs. The name and value are separated by a colon." it seems that the last word "colon" should be "comma" instead.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet

In which task and step of the codelab can this issue be found?
Task: Get data from the internet
Step: 8. Parse the JSON response with Moshi

Describe the problem
In the section "Update MarsApiService and OverviewViewModel", step 5:
"Now that you have the MoshiConverterFactory in place,..."

Instead of:
interface MarsApiService {
@get("photo")
fun getPhotos(): List
}

The code should be:
interface MarsApiService {
@get("photo")
suspend fun getPhotos(): List
}

Steps to reproduce?
You will get an error if you try to run the sample code without the "suspend" word

Versions
Android Studio version: 4.1.3
API version of the emulator: API 28

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

Android Basics: Load and display images from the Internet - Incorrect Screenshot


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
"3. Display an internet image"

Describe the problem
In "Update the ViewModel", step 7 says to run the app. It's accompanied by a screenshot of the app failing.

Additional information

Current screenshot (network error) My screenshot (network success)

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
ListAdapter (Refresher)

Describe the problem
In the sentence: "1. In the overview package, create a Kotlin class called PhotoGridAdapter.kt." it seems that the correct name of the class is PhotoGridAdapter, without .kt.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Load and display images from the Internet'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
Step 4

Describe the problem
There's a typo error in first item of under the block Add Recyclerview. It's written layout/gridview_item.xml instead of layout/grid_view_item.xml

Also in step 3, under the block Add loading and error images, there's a trailing d at the end of the second item of the list. Bellow is the full sentence:

Open res/drawable/loading_animation.xml. This drawable is an animation that rotates an image drawable, loading_img.xml, around the center point. (You don't see the animation in the preview.) d

I hope it'd help

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.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab

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

In which task and step of the codelab can this issue be found?

Describe the problem

I think getProperties should be getPhotos ?

Assign the result we just received from the backend server to the _status.value.

 val listResult = MarsApi.retrofitService.getProperties()
 _status.value = listResult

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.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Task: 3
Step: "Update the ViewModel"
Sub-step: 7

Describe the problem
The image that is shown doesn't accurately represent what should happen if it the instructions are followed. The incorrect image and the correct image are attached below.

Additional information
Include screenshots if they would be useful in clarifying the problem.
Screenshot 2021-04-25 144802
Screenshot 2021-04-25 145325

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
Get data from the internet >> 6. Connecting to the Internet

Describe the problem
val listResult = MarsApi.retrofitService.getProperties() -> should be
val listResult = MarsApi.retrofitService.getPhotos()

See screenshot below:
image

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Task: Display an internet image
Step: Update the ViewModel

Describe the problem
The example image is incorrect. It is not a screenshot of the URL of the first image from Mars, but instead an example of a connectivity issue message.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet#5

In which task and step of the codelab can this issue be found?
Object declarations

Describe the problem
In the sentence: "Each time your app calls MarsApi.retrofitService, the caller will access the same a singleton Retrofit object that implements MarsApiService which is created on the first access." it seem that the 'a' in "the same a singleton Retrofit object" is not necessary.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Task: 3
Step: "Use Binding Adapters"
Sub-step: 4

Describe the problem
The text "add a let{} block to the imageURL argument" should read "add a let{} block to the imgUrl argument"

Additional information
Include screenshots if they would be useful in clarifying the problem.
Screenshot 2021-04-25 175314

Android Basics: Load and display images from the Internet - Incorrect name of image library


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
"3. Display an internet image"

Describe the problem
In "Add loading and error images", step 5, it says:

Run the app. Depending on the speed of your network connection, you might briefly see the loading image as Glide downloads and displays the property image.

...but the training uses Coil, not Glide.

Edit: Section 8 "Learn More" also focuses on Glide, not Coil

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

Code does not compile after step 6 in this pathway ("Connect to the internet"). It is difficult to find any clue withine the solution code provided further along because of all the changes introduced in later steps.

This is the compilation error:

D:\Users\XXX-on drive D\AndroidStudioProjects\android-basics-kotlin-mars-photos-app-starter\app\build\tmp\kapt3\stubs\debug\com\example\android\marsphotos\network\MarsApi.java:13: error: cannot find symbol
public final com.example.android.marsphotos.network.MarsApiService getRetrofitService() {
^
symbol: class MarsApiService
location: package com.example.android.marsphotos.network

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.

Android Basics: Get data from the Internet - Missing moshi-kotlin library import


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
step 8

Describe the problem
This missing implementation of moshi library

implementation 'com.squareup.moshi:moshi-kotlin:1.12.0'

Without it you wont' have KotlinJsonAdapterFactory

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.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Add loading and error images

Describe the problem
In the sentence: "5. Run the app. Depending on the speed of your network connection, you might briefly see the loading image as Glide downloads and displays the property image." it seems that Glide should be Coil instead.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Loading and displaying images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: 'documentation'


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Add loading and error images

Describe the problem
The sentence "Depending on the speed of your network connection, you might briefly see the loading image as Glide downloads and displays the property image. "

Should read Coil

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

Here the .getProperties() should change to .getPhotos():

  1. Assign the result we just received from the backend server to the _status.value.

val listResult = MarsApi.retrofitService.getProperties()
_status.value = listResult

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.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet?authuser=1&continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%3Fauthuser%3D1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-getting-data-internet#6

In which task and step of the codelab can this issue be found?
7. Add Internet permission and Exception Handling - Android Permissions - step 2

Describe the problem
the app still crashed with 2error socket failed eperm (operation not permitted)"
In order to fix it, I had to disinstall the app from the emulator and reinstall it

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.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
The description regarding to create a bind() method that takes a MarsPhoto object as an argument and sets binding.property to that object. Need to be more explicit with related configuration on grid_view_item.xml.
🔻 PhotoGridAdapter.kt

fun bind(MarsPhoto: MarsPhoto) {
   binding.photo = MarsPhoto //  the error is here
   binding.executePendingBindings()
}

Describe the problem
I kept run into the error which could not go away event though I clean and rebuild the project multiple times. This is quite frustrating in the first place. 😥

🔻the error

D:\11-Andoid_IDE\Project\android-basics-kotlin-mars-photos-app\app\build\generated\source\kapt\debug\com\example\android\marsphotos\DataBinderMapperImpl.java:10: error: cannot find symbol
import com.example.android.marsphotos.databinding.GridViewItemBindingImpl;
^
symbol: class GridViewItemBindingImpl
location: package com.example.android.marsphotos.databinding

Steps to reproduce?

  1. Go to... com/example/android/marsphotos/overview/PhotoGridAdapter.kt
  2. Click on... Build > Clean Project and Build > Rebuild Project
  3. See error... > D:\11-Andoid_IDE\Project\android-basics-kotlin-mars-photos-app\app\build\generated\source\kapt\debug\com\example\android\marsphotos\DataBinderMapperImpl.java:10: error: cannot find symbol

Versions
Android Studio version: 30.0.2, 30.0.3
API version of the emulator: 30

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

How I resolve the error

  1. Go to... layout/grid_view_item.xml
  2. Modify the <data> label and set the name variable into "photo"
  <data>
        <variable
            name="photo"
            type="com.example.android.marsphotos.network.MarsPhoto" />
    </data>
  1. Click on... Build > Clean Project and Build > Rebuild Project
  2. The project is error free and able to run 🎉

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Load and display images from the Internet
Step 3 - Display an internet image -> Update the ViewModel

Describe the problem
At the last element (7), the codelab says to run the app, and that is shows the url:
"Run the app. The TextView now displays the URL of the first Mars photo. All you've done so far is set up the ViewModel and the LiveData for that URL."
But the picture below is one with Airplane Mode and with an error shown.
image

Steps to reproduce?

  1. Go to the page
  2. Scroll Before "Use Binding Adapters" section
  3. See error in the picture.

Versions
Any version, issue is in the web page

Additional information

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Typo and missing suspend keyword in code.
title: 'Android Basics Unit 4 issue:'


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

In which task and step of the codelab can this issue be found?
8. Parse the JSON response with Moshi
Update MarsApiService and OverviewViewModel
step 5. Now that you have the MoshiConverterFactory in place...

Describe the problem
In provided code:
interface MarsApiService {
@get("photo")
fun getPhotos(): List
}

There is a typo in word "photo", the endpoint name is "photos" and the function hasn't got a "suspend" keyword.

In Solution Code task you provide this code:
interface MarsApiService {
/**
* Returns a [List] of [MarsPhoto] and this method can be called from a Coroutine.
* The @get annotation indicates that the "photos" endpoint will be requested with the GET
* HTTP method
*/
@get("photos")
suspend fun getPhotos() : List
}

In this code the endpoint name is "photos" and function has suspend keyword so its correct.

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...
  4. That's it :)

Android Basics: Get data from the Internet: Unresolved reference: getProperties


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
Get data from the internet

In which task and step of the codelab can this issue be found?
Task 6 step 5

Describe the problem
Task says:
"5. Assign the result we just received from the backend server to the _status.value."

 val listResult = MarsApi.retrofitService.getProperties()
 _status.value = listResult

Problem is: Unresolved reference: getProperties()

Checked with the solution code, and it indeed seems like getProperties() method would not be used anyway.

Solution code:

    private fun getMarsPhotos() {

        viewModelScope.launch {
            _status.value = MarsApiStatus.LOADING
            try {
                _photos.value = MarsApi.retrofitService.getPhotos()
                _status.value = MarsApiStatus.DONE
            } catch (e: Exception) {
                _status.value = MarsApiStatus.ERROR
                _photos.value = listOf()
            }
        }
    }

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Step #3

Describe the problem
Wrong image is shown here

Steps to reproduce?

  1. Go to... step 7 of update the viewModel
  2. there is the wrong image show there instead of the imae with the url on the screen it is showing network error screen

Versions
Android Studio version:
API version of the emulator:

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

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
Assign the result we just received from the backend server to the _status.value.

val listResult = MarsApi.retrofitService.getProperties()
_status.value = listResult

Describe the problem
the getProperties should be replaced by getPhotos

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.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

Task 6. Connecting to the Internet, Step 5 of the Call the web service in OverviewViewModel

In the step 5 where we assign the result we just received from the backend server to the _status.value in the
example code there is a mistake. There should be val listResult = MarsApi.retrofitService.getPhotos() instead val listResult = MarsApi.retrofitService.getProperties()

Steps to reproduce?

  1. Go to the link and task 6 scroll down till the end
  2. I think the method name is incorrect in code example
    error2

Android Basics: Loading and displaying images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
4. Display a grid of images with a RecyclerView > Add Recyclerview > 1. Open layout/gridview_item...

Describe the problem
It is written gridview_item.xml instead of grid_view_item.xml (see https://github.com/google-developer-training/android-basics-kotlin-mars-photos-app/blob/starter/app/src/main/res/layout/grid_view_item.xml )

Value for endpoint changed from "photos" to "photo" in the MarsApiService interface shown in step 8


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
8. Parse the JSON response with Moshi,
Update MarsApiService and OverviewViewModel (step5)

Describe the problem
Here is the sample code snippet:

interface MarsApiService {
@get("photo")
fun getPhotos(): List
}

Problem 1: The endpoint should be "photos", otherwise a 404 error is occurs.
Problem 2: Earlier in the codelab, this was a suspend function. It is not clear to the student (i.e. me) whether this change is intentional rather than a typographical error.

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.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab

In which task and step of the codelab can this issue be found?

Describe the problem

Screenshot 2021-04-07 at 14 23 30

val listResult = MarsApi.retrofitService.getProperties()
_status.value = listResult

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.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?

Task 4 -> List Adapter (Refresher) -> Step 4

Describe the problem

The import is incorrect:

Import androidx.recyclerview.widget.RecyclerView and
com.example.android.marsrealestate.databinding.GridViewItemBinding if requested.

It should be: com.example.android.marsphotos.databinding.GridViewItemBinding

Proof:
Proof Of Mistake

Steps to reproduce?

  1. Go to... The above URL
  2. Click on... Task 4
  3. See error... In List Adapter section, specifically Step 4

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.
screenshot-developer android com-2021 04 17-22_11_00

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab

https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#6

In which task and step of the codelab can this issue be found?

Describe the problem

Cily typo at first line head, Cily -> Coil

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet#5

In which task and step of the codelab can this issue be found?
3. Open network/MarsApiService.kt. Add the following constant for the base URL for the web service.

Describe the problem
After pasting the code to Android Studio, and error showed up: "Const 'val' are only allowed on top level or in objects".

Steps to reproduce?
As stated above.

Versions
Android Studio version: 4.2.1
API version of the emulator: Not applicable.

Additional information
Nil.

Android Basics: Load and display images from the Internet - Status image is tiny


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#4

In which task and step of the codelab can this issue be found?
"5. Add error handling in RecyclerView"

Describe the problem
Under "Add the status ImageView", step 1, the instructions set width and height to wrap_content. This results in a tiny status icon on my emulator (you might need to zoom to see it):

Screenshot_1618160414

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'


https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#2

Task Display an internet image Step 7

Image below step 7 shows that there is a failure when trying to access to the internet. But actually when user did all the process until step 7, it should show the first image's link instead of error. The image is wrong.

Android Basics: Coroutines - is runBlocking() suspend or not?


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-introduction-coroutines?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-introduction-coroutines#3

In which task and step of the codelab can this issue be found?
Coroutines in Kotlin

Describe the problem

Last paragraph states:

Not necessarily. getValue() is actually called in the function passed into runBlocking(), which is a suspend function, similar to the ones passed into launch() and async(). However, getValue() is not called in main() itself, nor is runBlocking() a suspend function, so main() is not marked with suspend. If a function does not call a suspend function, then it does not need to be a suspend function itself.

Hello, I'm confused by this - does this paragraph want to say that runBlocking() is or is not a suspend function?

Best regards,
Richard Beneš

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
Add the photo grid adapter

Describe the problem
In the sentence: "Note: This might be a good time to review the RecyclerView codelabs!" it seems that the RecyclerView is meant to be a hyperlink (to the codelab for Recylerview), but it isn't.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:' missin suspend qualifier to getPhotos
labels: ''
assignees: ''


URL of codelab

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

In which task and step of the codelab can this issue be found?
at point 7, you wrote:

interface MarsApiService {
@get("photo")
fun getPhotos(): List
}

Describe the problem
The app fails with error "Failure: unable to create call adapter for java.util.List<com.example.android.marsphotos.network.MarsPhoto> from methdo MarsApiService.getPhotos

Additional information
just add "suspend" keyword again and everything works fine.
interface MarsApiService {
@get("photo")
suspend fun getPhotos(): List
}

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
let scope function

Describe the problem
In the sentence: "4. Inside the bindImage() function, add a let{} block to the imageURL argument, using the safe call operator." it seems that imageURL should be imageUrl instead.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#4

In which task and step of the codelab can this issue be found?
Enum Classes in Kotlin

Describe the problem
It says,

Usage:
var direction = Direction.NORTH;

However, in the Kotlin Coding conventions docs, it says:

Omit semicolons whenever possible.

Therefore, it seems appropriate to remove the semicolon in the code.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet#7

In which task and step of the codelab can this issue be found?
Add Moshi library dependencies

Describe the problem
The page says,

Replace this

// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
// Retrofit with Moshi Converter
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"

with this

// Retrofit with Moshi Converter
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'

The first dependency is missing in the code block below the with this.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Loading and displaying images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%3Fhl%3Dja%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
4. Display a grid of images with a RecyclerView of Add Recyclerview step's context may have typo.

Describe the problem
Add Recyclerview step's context may have typo.

In this step you will change the app's layout to use a recycler view with a grid layout, rather than the single image view.

Open layout/gridview_item.xml. Remove the viewModel data variable.
Inside the tag, add the following photo variable of the type MarsPhoto.

So,
layout/gridview_item.xml -> layout/grid_view_item.xml

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#3

In which task and step of the codelab can this issue be found?
Step 9 of "Add Recyclerview"

Describe the problem
In the sentence: "9. Open layout/gridview_item.xml.", it seems that gridview_item should be grid_view_item instead.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
Step 6 - 5

Describe the problem
I think this code might be from another codelab:

val listResult = MarsApi.retrofitService.getProperties()
_status.value = listResult

getProperties() is not implemented in the interface.

Steps to reproduce?

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

Versions
Android Studio version: NA
API version of the emulator: NA

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

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

Task 6: Connecting to the internet, Step: 5

**In the code snippet:
val listResult = MarsApi.retrofitService.getProperties()
is mentioned instead of
val listResult = MarsApi.retrofitService.getPhotos()
**

Steps to reproduce?

  1. Go to the URL
  2. Click on Task 6 (Connecting to Internet)
  3. Scroll to Step 5

Versions
Android Studio version: NA
API version of the emulator: NA

Additional information
Screenshot from 2021-04-08 10-50-53

BindingAdapter instructions clarification

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
Display an internet image ->
Create a binding adapter and use Coil ->
2. In BindingAdapters.kt. Create a bindImage() function...

Describe the problem
The instructions here don't specify that the function should be defined outside of the class.
If you define the function inside the class then you'll receive an error like the following:

is not static and requires an object to use, retrieved from the DataBindingComponent. If you don't use an inflation method taking a DataBindingComponent, use DataBindingUtil.setDefaultComponent or make all BindingAdapter methods static.

Steps to reproduce?

  1. Follow the instructions, but define your BindingAdapter function inside the BindingAdapters class
  2. Run the app
  3. See the binding error

Android Basics: Load and display images from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue: example of result'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-internet-images?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-internet-images#2

In which task and step of the codelab can this issue be found?
'Update the ViewModel' > step 7

Describe the problem
The image of the example show an error.

Additional information
image

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
Get data from the internet --> task #6 Connecting to the Internet

Describe the problem

Where: Call the web service in OverviewViewModel --> step #5
What's wrong: incorrect name of function is used
It states that the .getProperties() function needs to be used, while what we actually need to use is .getPhotos()

Steps to reproduce?

  1. Go to the provided URL
  2. Scroll down to the bottom
  3. You can now see step #5 and the incorrect function name

Versions
Android Studio version:
API version of the emulator:

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

Android Basics: Get data from the Internet


name: Android Basics Unit 4 issue
about: Report problems with the Android Basics Unit 4 codelabs
title: 'Android Basics Unit 4 issue:'
labels: ''
assignees: ''


URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-getting-data-internet#5

In which task and step of the codelab can this issue be found?
ViewModelScope

Describe the problem
Part of the code in step 4 is: val listResult = MarsApi.retrofitService.getPhotos()
But Part of the code in step 5 is: val listResult = MarsApi.retrofitService.getProperties()

The functions at the last of the line are different in the two steps.

Steps to reproduce?
As stated above.

Versions
Not applicable.

Additional information
Nil.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.