Code Monkey home page Code Monkey logo

android-basics-kotlin-dogglers-app's People

Contributors

android-dev-lxl avatar osuleymanova avatar owenlarosa avatar owenscott-gds avatar the-scrambler 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

Watchers

 avatar  avatar  avatar  avatar

android-basics-kotlin-dogglers-app's Issues

Android Basics: Dogglers app

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

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

Describe the problem
The tests grid_list_content_at_first_position of all the classes fail if you don`t wirite raw the information.

Steps to reproduce?

  1. Go to java>com.example.dogglers (androidTest)
  2. Click on.com.example.dogglers>Run
  3. See error 3 tests fail

Versions
Android Studio version: Chipmunk 2021.2.1
API version of the emulator: 30

Additional information
Include screenshots if they would be useful in clarifying the problem.
If you use the strings values to show the information as the images of the codelab the tests fails. They only pass if instead of "Age: 7" you write "7".
The complete error message is "androidx.test.espresso.NoMatchingViewExceprion: No views in hierarchy found matching: an instance of android.widget.TextView and view.getText() with or without transformation to match is "7".
image
With this output of the app the tests fail.

Android Basics: Dogglers app

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

Describe the problem
It seems to me that in the adapter (onCreateViewHolder) viewType is always 0, so it never uses the Grid layout
because the "private val layout: Int" variable is never used

Android Basics: Display a scrollable list quizz

URL of codelab
https://developer.android.com/courses/quizzes/android-basics-kotlin-unit-2-pathway-3/android-basics-kotlin-unit-2-pathway-3?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-2-pathway-3%3Fhl%3Den%23quiz-%2Fcourses%2Fquizzes%2Fandroid-basics-kotlin-unit-2-pathway-3%2Fandroid-basics-kotlin-unit-2-pathway-3&hl=en

In which question of the quizz can this issue be found?
Question 2 and 5

Describe the problem
In question 2, the answer "val listValues: MutableList<Boolean>" is reported as a non valid Kotlin statement, but it is not true
In question 5, the answer "In order to use a class from another package, you have to explicitly import it in your code." is expected. It is not correct, as it is valid to use a class from another package via its fully qualified name, without importing the class.

Steps to reproduce?
N/A

Versions
N/A

Additional information
None.

Android Basics: Dogglers app

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

In which task and step of the codelab can this issue be found?
The initial code
Describe the problem
Android complains at runtime that since MaterialCardView is used as the root layout for the list item view, the app must use Theme.MaterialComponents or one of its descendants. After I double-checked the /vales/themes folder, the AppTheme is Theme.MaterialComponents.DayNight.DarkActionBar. Would that be an issue of compatibility?
Using androidx.cardview.widget.CardView work fine, and all tests passed

Steps to reproduce?

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

Versions
Android Studio version: Bumblebee
API version of the emulator: 30

Additional information
Include screenshots if they would be useful in clarifying the problem.
Screenshot from 2022-01-27 01-50-20
Screenshot from 2022-01-27 01-50-35

Android Basics: Dogglers app

The following test fails if we follow the instructions in the codelab. This is from BaseTest.kt:

    fun checkFirstPosition() {
        hasListItemContent("Tzeitel", "7",  "sunbathing",  R.drawable.tzeitel)
    }

The codelab suggests that, instead of just inserting theses strings, we first format them:

Use the string resources, dog_age, and dog_hobbies to format the age and hobbies appropriately.

The relevant format strings are in strings.xml:

    <string name="dog_age">Age: %1$s</string>
    <string name="dog_hobbies">Hobbies: %1$s</string>

So if you want the test above to succeed, you have to modify it to:

    fun checkFirstPosition() {
        hasListItemContent("Tzeitel", "Age: 7",  "Hobbies: sunbathing",  R.drawable.tzeitel)
    }

Graddle build error after import. can't build the project.

URL of codelab
https://pastebin.com/yeKDbVbC

In which task and step of the codelab can this issue be found?
after import, and when click sync

Describe the problem
first of all sorry for my bad english.

after i imported the project into android studio it shows the error, i've tried to search the solution on google like changing gradle.properties or jvm but it still the same. the error is not solved. i can't build the project so i cant work on the project

Versions
_Android Studio version: Bumblebee _
_API version of the emulator: 19 _

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

image
image
image

Android Basics: Dogglers app

URL of codelab
https://github.com/google-developer-training/android-basics-kotlin-dogglers-app/tree/main

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

Describe the problem
when i click buuild the app it wont finish the processe croctely and gives an messages says :
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @74713501

Steps to reproduce?

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

Versions
Android Studio version: 2020.3.0.0 arctic fox
API version of the emulator:

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

Android Basics: Dogglers app

URL of codelab

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

Task 3 step 5

Describe the problem

If you implement the string resource for dog_age and dog_hobbies correctly like you are supposed to do in every test class one test will fail. That is because the test apparently checks if the content at the first position is desplayed correctly. The error happens because if implented correctly the card should show "age:7" but the test checks for "7" which causes an error.

Steps to reproduce?
Impement the project and at the end in the last step the code should look something like this:
holder.dogAge.text = context.resources?.getString(R.string.dog_age, item.age)
holder.dogHobby.text = context.resources?.getString(R.string.dog_hobbies, item.hobbies)

You can run the app and everything will be displayed as it should be.
You can then run the different tests and you will always see this error:

androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "7"

See Describe the problem for my explaination of the problem( I am really inexperienced so it could be something else)

Versions
_Android Studio version: Android Studio Chimpmunk 2021.2.1 Patch 1
API version of the emulator: 30

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

Android Basics: Dogglers app

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

In which task and step of the codelab can this issue be found?
3. Get started]

Describe the problem
If you click the Grid Button, it doesn't look correct because the ViewType passed to onCreateViewHolder is 0 so depending on how you coded onCreateViewHolder you will most likely default to the wrong layout. For example I had this

    val layoutResourceId = when(viewType) {
        Layout.GRID -> R.layout.grid_list_item
        else -> R.layout.vertical_horizontal_list_item
    }

based on reading the codelab. Originally I had this version below since normally I don't like leaving things to chance and looking back I wish I had kept it since it would have saved me some debugging time :)

    val layoutResourceId = when(viewType) {
        Layout.HORIZONTAL, Layout.VERTICAL -> R.layout.vertical_horizontal_list_item
        Layout.GRID -> R.layout.grid_list_item
        else -> throw IllegalArgumentException("Unknown viewType $viewType")
    }

The fix was very easy I just added to DogCardAdapter:

override fun getItemViewType(position: Int): Int {
    return layout;
}

Then everything was good again :)

Steps to reproduce?

  1. Run the app
  2. Click Grid button
  3. See that the layout looks bad. In my case I was still using R.layout.vertical_horizontal_list_item instead of R.layout.grid_list_item.

Versions
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.intellij.plugins.markdown (212.5457.16), Dart (212.5744), io.flutter (69.0.2)

Additional information
Include screenshots if they would be useful in clarifying the problem.
Screen Shot 2022-07-09 at 8 12 11 AM

Android Basics: Display a scrollable list examn

URL of codelab

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

Describe the problem

When reviewing the answer in the questionnaire, an error usually appears and it does not qualify.

Steps to reproduce?

  1. Go to...
  2. i attach images
  3. Click on...
  4. See error...

Versions
Android Studio version:
API version of the emulator:

Additional information
Include screenshots if they would be useful in clarifying the problem.
Display a scrollable list issues examn.pdf

Android Basics: Dogglers app

URL of codelab

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

Describe the problem

    GridLayout id incompatible with latest Android Studio.

    Warning shown --
    This operation requires the library androidx.gridlayout:gridlayout:+.
    
    Problem: Inconsistencies in the existing project dependencies found.
    Version incompatibility between:
    -   com.google.android.material:material:1.3.0@aar
    and:
    -   androidx.fragment:fragment-ktx:1.3.3@aar
    
    With the dependency:
    -   androidx.annotation:*:1.1.0
    versus:
    -   androidx.annotation:*:2.0.0
    
    The project may not compile after adding this library.
    Would you like to add it anyway?

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: Dogglers app

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

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

Describe the problem
Tests are passing when the TextViews don't contain the content of the strings recource.

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: Dogglers app

Android Basics: Dogglers app

Android Basics: Dogglers app

URL of codelab
android-basics-kotlin-unit-2-pathway-3 > Project: Dogglers app

In which task and step of the codelab can this issue be found?
In the codelab ----> Step 3. Get started

Describe the problem
After solving the codelab (this means creating the project, creating the adapter and the list_item xmls) and trying to run the tests, on my current version of Espresso:

    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'

the tests called 'checkFirstPosition()' will always fail.

This is because the method expects the first item in each RecyclerView to be Dog(R.drawable.tzeitel, "Tzeitel" , "7" , "sunbathing"). But the TODO comment in the adapter instructs you do use this string constant:<string name="dog_hobbies">Hobbies: %1$s</string> (See the adapter here. )
This results in the string "Hobbies: sunbathing", which makes the assertion fail, because the test calls
hasListItemContent("Tzeitel", "7", "sunbathing", R.drawable.tzeitel)
Instead of
hasListItemContent("Tzeitel", "7", "Hobbies: sunbathing", R.drawable.tzeitel)

ViewMatchers.withText(text) calls Matchers.is( T ) is the same as equalTo( T ), as mentioned in the javadoc. It's not a substitute for a 'contains' method.

Steps to reproduce?

  1. Have working copy of this project.
  2. Go to DogCardAdapter
  3. See the last TODO in this class: "Set the text for the current dog's hobbies by passing the hobbies to the R.string.dog_hobbies string constant."
  4. Do as instructed in step 3, so that the TextViews containing the hobbies will always start with "hobbies: ".
  5. Run tests, notice all tests calling 'checkFirstPosition()' failing

Versions
Android Studio version: 2021.2.1 Patch 1
API version of the emulator: API 30

Additional information
Include screenshots if they would be useful in clarifying the problem.
Attached screenshots with the code in question
scr1
scr2
scr3_FIX

Android Basics: Dogglers app

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

The error is (for age):
androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "7"

or (for hobbies):
androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: an instance of android.widget.TextView and view.getText() with or without transformation to match: is "sunbathing"

In which task and step of the codelab can this issue be found?
A test is wrong. After finishing and running tests the problem is seen.

Describe the problem
The test in the GridListTests.kt, HorizontalListTests.kt or VerticalListTests.kt:
image
image
image

Runs the Test in BaseTest.kt
image
Which runs this test in the same file:
image

The problem is the arguments, "7" and "sunbathing, being passed to checkFirstPosition(). When resource strings are used, which is the right thing to do here as told in the codelab, the TextView for age is "Age: 7" and the TextView for hobbies is "Hobbies: sunbathing". Hence the issue.

Steps to reproduce?
Develop the app and run tests. Make sure to use resource strings when building the adapter for age and hobbies.

Versions
Android Studio version:
API version of the emulator:

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

Android Basics: Dogglers app

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

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

Describe the problem
checkFirstPosition function of BasicTest class must be
fun checkFirstPosition() { hasListItemContent("Tzeitel", "Age: 7", "Hobbies: sunbathing", R.drawable.tzeitel) } so it could match with the required display

Versions
Android Studio version: 32

Additional information
Include screenshots if they would be useful in clarifying the problem.
The old checkFirstPosition() function
image

Faulty Test Code

URL of codelab
Link

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

Describe the problem
I'm sure there is no error in my project, but the result of test may change with time. When I ran the GridListTest, HorizontalListTest, VerticalListTest on Pixel 3 XL API 29 emulator, it will sometimes result in an error related to scrolling. The error, however, will sometimes DISAPPEAR under exactly identical condition. When I launched another brand new emulator Pixel 5, the error still occurred randomly. Finally, I ran the test code on a real Google Pixel 3, and I passed all the tests.

error message:

androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with text: is "Faye"

View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1440, height=2960, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302fe
  fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
  pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} 
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1440, height=2792, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@583efe9, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} 
|
+-->ViewStub{id=16908692, res-name=action_mode_bar_stub, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@37c546e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
+-->FrameLayout{id=-1, visibility=VISIBLE, width=1440, height=2621, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@640e39c, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=171.0, child-count=1} 
|
+--->ActionBarOverlayLayout{id=2131230845, res-name=decor_content_parent, visibility=VISIBLE, width=1440, height=2621, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@d37a52b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} 
|
+---->ContentFrameLayout{id=16908290, res-name=content, visibility=VISIBLE, width=1440, height=2425, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.appcompat.widget.ActionBarOverlayLayout$LayoutParams@440b321, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=196.0, child-count=1} 
|
+----->FrameLayout{id=-1, visibility=VISIBLE, width=1440, height=2425, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@b096907, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1} 
|
+------>RecyclerView{id=2131231139, res-name=vertical_recycler_view, visibility=VISIBLE, width=1440, height=2425, has-focus=false, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@5498ea3, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} 
|
+------->MaterialCardView{id=-1, visibility=VISIBLE, width=1384, height=960, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@7fba559, tag=null, root-is-layout-requested=false, has-input-connection=false, x=28.0, y=28.0, is-checked=false, child-count=1} 
|
+-------->ConstraintLayout{id=-1, visibility=VISIBLE, width=1384, height=960, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@b1b052a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4} 
|
+--------->AppCompatImageView{id=2131230863, res-name=dog_image, visibility=VISIBLE, width=1384, height=679, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@e902f1b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
+--------->MaterialTextView{id=2131230864, res-name=dog_name, visibility=VISIBLE, width=273, height=149, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@ba078b8, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=679.0, text=Tzeitel, input-type=0, ime-target=false, has-links=false} 
|
+--------->MaterialTextView{id=2131230861, res-name=dog_age, visibility=VISIBLE, width=225, height=132, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@e6ba691, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=828.0, text=Age: 7, input-type=0, ime-target=false, has-links=false} 
|
+--------->MaterialTextView{id=2131230862, res-name=dog_hobby, visibility=VISIBLE, width=606, height=132, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@5bc49f6, tag=null, root-is-layout-requested=false, has-input-connection=false, x=778.0, y=828.0, text=Hobbies: sunbathing, input-type=0, ime-target=false, has-links=false} 
|
+------->MaterialCardView{id=-1, visibility=VISIBLE, width=1384, height=960, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@c406864, tag=null, root-is-layout-requested=false, has-input-connection=false, x=28.0, y=1044.0, is-checked=false, child-count=1} 
|
+-------->ConstraintLayout{id=-1, visibility=VISIBLE, width=1384, height=960, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@94396c9, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4} 
|
+--------->AppCompatImageView{id=2131230863, res-name=dog_image, visibility=VISIBLE, width=1384, height=679, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@22ea1ce, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
+--------->MaterialTextView{id=2131230864, res-name=dog_name, visibility=VISIBLE, width=234, height=149, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@67bd8ef, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=679.0, text=Leroy, input-type=0, ime-target=false, has-links=false} 
|
+--------->MaterialTextView{id=2131230861, res-name=dog_age, visibility=VISIBLE, width=225, height=132, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@6ae5ffc, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=828.0, text=Age: 4, input-type=0, ime-target=false, has-links=false} 
|
+--------->MaterialTextView{id=2131230862, res-name=dog_hobby, visibility=VISIBLE, width=1089, height=132, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@265d685, tag=null, root-is-layout-requested=false, has-input-connection=false, x=295.0, y=828.0, text=Hobbies: sleeping in dangerous places, input-type=0, ime-target=false, has-links=false} 
|
+------->MaterialCardView{id=-1, visibility=VISIBLE, width=1384, height=960, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.recyclerview.widget.RecyclerView$LayoutParams@cd7150b, tag=null, root-is-layout-requested=false, has-input-connection=false, x=28.0, y=2060.0, is-checked=false, child-count=1} 
|
+-------->ConstraintLayout{id=-1, visibility=VISIBLE, width=1384, height=960, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@fc0b294, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=4} 
|
+--------->AppCompatImageView{id=2131230863, res-name=dog_image, visibility=VISIBLE, width=1384, height=679, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@ded513d, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
+--------->MaterialTextView{id=2131230864, res-name=dog_name, visibility=VISIBLE, width=294, height=149, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@efa5d32, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=679.0, text=Frankie, input-type=0, ime-target=false, has-links=false} 
|
+--------->MaterialTextView{id=2131230861, res-name=dog_age, visibility=VISIBLE, width=225, height=132, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@fab1a83, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=828.0, text=Age: 2, input-type=0, ime-target=false, has-links=false} 
|
+--------->MaterialTextView{id=2131230862, res-name=dog_hobby, visibility=VISIBLE, width=695, height=132, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@2406400, tag=null, root-is-layout-requested=false, has-input-connection=false, x=689.0, y=828.0, text=Hobbies: stealing socks, input-type=0, ime-target=false, has-links=false} 
|
+---->ActionBarContainer{id=2131230771, res-name=action_bar_container, visibility=VISIBLE, width=1440, height=196, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.appcompat.widget.ActionBarOverlayLayout$LayoutParams@bfadbdf, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2} 
|
+----->Toolbar{id=2131230769, res-name=action_bar, visibility=VISIBLE, width=1440, height=196, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@e5b56fb, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3} 
|
+------>AppCompatTextView{id=-1, visibility=VISIBLE, width=291, height=93, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.appcompat.widget.Toolbar$LayoutParams@286b318, tag=null, root-is-layout-requested=false, has-input-connection=false, x=252.0, y=51.0, text=Dogglers, input-type=0, ime-target=false, has-links=false} 
|
+------>AppCompatImageButton{id=-1, desc=Navigate up, visibility=VISIBLE, width=196, height=196, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=true, is-enabled=true, is-focused=false, is-focusable=true, is-layout-requested=false, is-selected=false, layout-params=androidx.appcompat.widget.Toolbar$LayoutParams@a7bc171, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
+------>ActionMenuView{id=-1, visibility=VISIBLE, width=0, height=196, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.appcompat.widget.Toolbar$LayoutParams@a07fb56, tag=null, root-is-layout-requested=false, has-input-connection=false, x=1440.0, y=0.0, child-count=0} 
|
+----->ActionBarContextView{id=2131230777, res-name=action_context_bar, visibility=GONE, width=0, height=0, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=true, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@e7e67d7, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=0} 
|
+->View{id=16908336, res-name=navigationBarBackground, visibility=VISIBLE, width=1440, height=168, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@6bfe8c4, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=2792.0} 
|
+->View{id=16908335, res-name=statusBarBackground, visibility=VISIBLE, width=1440, height=171, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@43a03ad, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0} 
|
	at dalvik.system.VMStack.getThreadStackTrace(Native Method)
	at java.lang.Thread.getStackTrace(Thread.java:1720)
	at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:16)
	at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:36)
	at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:106)
	at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:31)
	at com.example.dogglers.VerticalListTests.vertical_scrolling(VerticalListTests.kt:56)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:154)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:395)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

Versions
Android Studio version: 11.0.11
API version of the emulator: 29

Android Basics: Dogglers app - Text mistake

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

In which task and step of the codelab can this issue be found?
Task: Project Dogglers App
Page 3. Get Started

Describe the problem
Instead of "vertical_horizontal_list_item.xml", the text says "horizontal_vertical_list_item.xml".

Steps to reproduce?
Open Link

Versions
Android Studio version: 2021.1.1 Patch 1
API version of the emulator: No needed

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

Android Basics: Dogglers app

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

In which task and step of the codelab can this issue be found?
step 4: Test you app

Describe the problem
there is a problem in the following instrumentation tests provided in the github download:

horizontal_scroll_content_at_first_position()   //can be found in HorizontalListTests.kt
vertical_scroll_content_at_first_position()   //can be found in VerticalListTests.kt

these two tests use the same function which is:
checkFirstPosition()
which in turn calls the following function:
hasListItemContent(name: String, age: String, hobbies: String, imageResource: Int)
the issue is that the function cannot find a textView with the expected value for the age("7") and hobbies("sunbathing") of the dog (Tzeitel)
to fix this test I had to change the expected value to the whole textView text, in other words the expected value for age is "Age: 7" not just "7", actually wrote like this:

onView(withText("Age: $age"))
            .check(matches(isDisplayed()))

and the same goes for the hobbies ("Hobbies: $hobbies")

Steps to reproduce?
run the instrumentation tests "provided on github" on a working version of the Dogglers app

Versions
Android Studio version: 2021.2.1 patch 1
I used my android phone to run the app

P.S.
I also had problems in the vertical_scrolling() and horizontal_scrolling() instrumentation tests, so I applied the Espresso setup instructions as provided in this link https://developer.android.com/training/testing/espresso/setup#set-up-environment
after applying, the vertical_scrolling() test worked but the horizontal_scrolling() test did not work with other tests; it sometimes worked when I run it on its own. this may be an issue with my phone, just wanted to let you know

Thank you for this amazing course and your continuous support :)

Android Basics: Dogglers app

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

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

Describe the problem
There's a misspelling of one of the file names. It's vertical_horizontal_list_item.xml, not horizontal_vertical_list_item.xml.

========

Screen Shot 2022-04-28 at 9 04 11 AM

Android Basics: Dogglers app

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-training-project-dogglers-app#2

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

Screen Shot 2022-05-17 at 2 11 46 PM

Describe the problem

Package is not specified in the manifest file.

PLEASE FIX THIS. SEE SCREENSHOT

THANKS

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: Dogglers app - issue on androidTest

URL of codelab
Project: Doggler app

In which task and step of the codelab can this issue be found?
While running my test cases

Describe the problem
There are four test cases

  1. ButtonTests - which has no issue
  2. The rest three has one issue on checkFirstPosition function

Actual code:

 fun checkFirstPosition() {
        hasListItemContent("Tzeitel", "7", "sunbathing",
            R.drawable.tzeitel)
    }

But the function should be:

 fun checkFirstPosition() {
        hasListItemContent("Tzeitel", "Age: 7", "Hobbies: sunbathing",
            R.drawable.tzeitel)
    }

image

In the colab it has age and hobbies before the actual content

So I think the checkFirstPosition test case is wrong

Steps to reproduce?

  1. Go to androidTest
  2. Run any test case except ButtonTests such as HorizontalListTests
  3. See error...

image

Android Basics: Dogglers app

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

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

Describe the problem
After I downloaded the code and opened it in Android Studio, it refuses to run the app and about half of the code is in red. How do I tackle the problem? I've no clue where to start... Thanks!

Steps to reproduce?

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

Versions
Android Studio version: bumblebee 2021.1.1
API version of the emulator: 26 (Pixel2)

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

Android Basics: Dogglers app

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

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

Describe the problem
When running the given test suite, these tests always fail:

com.example.dogglers.VerticalListTests#vertical_scrolling
com.example.dogglers.HorizontalListTests#horizontal_scrolling
com.example.dogglers.GridListTests#vertical_scrolling

While debugging ,I'm noticing that swipeUp() and swipeLeft() produce not noticeable effects on the screen: i.e., ViewHolders aren't cycled on the display. That being said, actions such as

onView(withId(R.id.grid_recycler_view))
           .perform(scrollToPosition<RecyclerView.ViewHolder>(lastPosition))

work as expected.

Versions
Android Studio version: Android Studio Chipmunk | 2021.2.1 Patch 1
API version of the emulator: 19

function checkFirstPosition() will always fail the test

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

In which task and step of the codelab can this issue be found?
The test functions grid_list_content_at_first_position, horizontal_scroll_content_at_first_position and vertical_scroll_content_at_first_position will never pass because of the function checkFirstPosition() in BaseTest.kt

Describe the problem
In the DogCardAdapter.kt you are supposed to pass the arguments dog.age and dog.hobbies to the String constant in strings.xml by doing something like:
holder.dogAge?.text = resources?.getString(R.string.dog_age, dog.age)

However, the tests check if the arguments are displayed instead of checking if the actual modified string is displayed.
For example: the String that is displayed is: "Age: 7", while the test checks if the string is actually "7".

Steps to reproduce?
Run either GridListTests, HorizontalTests or VerticalListTests

Versions
Android Studio version: 2021.2.1 Patch 1
API version of the emulator: /

Additional information
The tests will pass if you modify hasListItemContent() in BaseTest.kt. I basically use containsString to check if the String is part of the String that is displayed instead of looking for an exact match.

import org.hamcrest.core.StringContains.containsString

    private fun hasListItemContent(name: String, age: String, hobbies: String, imageResource: Int) {
        onView(withText(name))
            .check(matches(isDisplayed()))
        onView(withText(containsString(age)))
            .check(matches(isDisplayed()))
        onView(withText(containsString(hobbies)))
            .check(matches(isDisplayed()))
        onView(withDrawable(imageResource))
            .check(matches(isDisplayed()))
    }

Alternatively you could also modify checkFirstPostition() to match the displayed String:

fun checkFirstPosition() {
    hasListItemContent("Tzeitel", "Age: 7", "Hobbies: sunbathing",
        R.drawable.tzeitel)
}

Original Code

    private fun hasListItemContent(name: String, age: String, hobbies: String, imageResource: Int) {
        onView(withText(name))
            .check(matches(isDisplayed()))
        onView(withText(age))
            .check(matches(isDisplayed()))
        onView(withText(hobbies))
            .check(matches(isDisplayed()))
        onView(withDrawable(imageResource))
            .check(matches(isDisplayed()))
    }
    fun checkFirstPosition() {
        hasListItemContent("Tzeitel", "7", "sunbathing",
            R.drawable.tzeitel)
    }

Possibly flaky test in VerticalListTests

URL of codelab
Dogglers

In which task and step of the codelab can this issue be found?
Running the tests at the end

Describe the problem
The test vertical_scrolling is failing for me. I don't think its a bug with my application code though because when I put a sleep after performing the swipe it is passing the test. So it looks like a race condition when the view is being checked if its displayed before the swipe animation is completed. Error:

androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'is displayed on the screen to the user' doesn't match the selected view. Expected: is displayed on the screen to the user Got: "MaterialTextView{id=2131230864, res-name=dog_name, visibility=VISIBLE, width=115, height=71, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@fb2e21e, tag=null, root-is-layout-requested=false, has-input-connection=false, x=21.0, y=530.0, text=Faye, input-type=0, ime-target=false, has-links=false}"

Steps to reproduce?
Run the vertical_scrolling test on an emulator. I am using Pixel 2 API 28 (Android 9). All animations have been disabled

Versions
Android Studio Arctic fox 2020.3.1 patch 4
Api level 28

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

Android Basics: Dogglers app

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

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

Describe the problem
I think there is a problem in one of the pre-written tests, let me clarify:
THIS is the provided test case:

/**
     * Check the content of a card
     *
     * @param name
     * @param age The full age string as it appears on the screen
     * @param hobbies The full hobbies string as it appears on the screen
     * @param imageResource The image resource Id
     */
    private fun hasListItemContent(name: String, age: String, hobbies: String, imageResource: Int) {
        onView(withText(name)).check(matches(isDisplayed()))
        onView(withText(age)).check(matches(isDisplayed()))
        onView(withText(hobbies)).check(matches(isDisplayed()))
        onView(withDrawable(imageResource)).check(matches(isDisplayed()))
    }

    /**
     * Check the content of the first card
     */
    fun checkFirstPosition() {
        hasListItemContent("Tzeitel", "7", "sunbathing", R.drawable.tzeitel)
    }

as said "param age and hobbies are the full age and hobbies string as it appears on the screen", however in the test it doesn't check the full string (e.g. "Age: 7"), but only the changeable value (e.g. "7"). So that I've edited the test to make it right, replacing age with "Age: $age" and hobbies with "Hobbies: $hobbies" as shown here:

private fun hasListItemContent(name: String, age: String, hobbies: String, imageResource: Int) {
        onView(withText(name)).check(matches(isDisplayed()))
        onView(withText("Age: $age")).check(matches(isDisplayed()))
        onView(withText("Hobbies: $hobbies")).check(matches(isDisplayed()))
        onView(withDrawable(imageResource)).check(matches(isDisplayed()))
    }

Of course many solutions are possible here like, (e.g. changing hasListItemContent's call inside checkFirstPosition to the expected full string), but it's your call to choose what you see suits better.

Steps to reproduce?

  1. Go to Step 3: Get started of the same codelab to download the project.
  2. Sync Gradle and update if necessary.
  3. Run HorizontalListTests and check horizontal_scroll_content_at_first_position test

Android Basics: Dogglers app

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

In which task and step of the codelab can this issue be found?
In the testing of the dogglers app phase

Describe the problem
The BaseTest.kt file has incorrect info in the function checkFirstPosition(). Currently the method hasListItem(, , , ) is where the error resides. The and inputs have the string "Age: 7" and "Hobbies: sunbathing" when it should just be "7" and "sunbathing". The hardcoded strings of the actual property names in this is causing the tests to fail.

Steps to reproduce?

  1. Build the project as instructed by the codelab
  2. run the first test suite
  3. One test will pass and all others will fail. You will see that the error will say something along the lines that "Age: 7" cannot be found. That is because in the data package's DataSource.kt file, all ages are "" and not "Age: ". The same goes for hobbies.

Versions
Android Studio version: 2021.1
API version of the emulator: API 32

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

Android Basics: Dogglers app


name: 'Android Basics: Dogglers app'
about: Describe this issue template's purpose here.
title: 'Android Basics: Dogglers app'
labels: ''
assignees: ''


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

In which task and step of the codelab can this issue be found?
Get Started - Running the App

Describe the problem
I downloaded the zip file from the main branch and opened it up in Android Studio as I normally would but im getting a Migrate Project to Gradle error stating that this project
does not use the Gradle build system. Project contains gradle folder and files but wont migrate

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: Dogglers app - Incorrect filename referenced in the documentation

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

In which task and step of the codelab can this issue be found?
Project: Dogglers App: Step 3: Get Started

Describe the problem
There is a reference to a file which does not exist: 'horizontal_vertical_list_item.xml'.
The file is actually 'vertical_horizontal_list_item.xml'

Additional information
image

image

Android Basics: Dogglers app - Cannot import VCS from URL

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

In which task and step of the codelab can this issue be found?
Dogglers App: Step 3: Get Started

Describe the problem
The link to the project is provided as 'https://github.com/google-developer-training/android-basics-kotlin-dogglers-app/tree/main'. However, the additional specification of 'tree/main' is unnecessary and causes problems with importing from the URL.

Steps to reproduce?

  1. Go to... Android Studio
  2. Click on... Get from VCS
  3. Enter... https://github.com/google-developer-training/android-basics-kotlin-dogglers-app/tree/main for the URL
  4. See error... Clone failed: https://github.com/google-developer-training/android-basics-kotlin-dogglers-app/tree/main/ not found.

Versions
Android Studio version: Android Studio Bumblebee | 2021.1.1 Patch 2
Build #AI-211.7628.21.2111.8193401, built on February 17, 2022

Android Basics: Dogglers app

URL of codelab

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

Describe the problem

There is no string dog_name in string.xml //I dont know if it was supposed to be in the test though...

Steps to reproduce?

  1. Go to... String,xml
  2. There is no dog_name in there...

Versions
Android Studio version:
API version of the emulator:

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

Android Basics: Dogglers app

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

In which task and step of the codelab can this issue be found?
Task "Get Started", step 3

Describe the problem
In the screen shot, the highlighted bit has had "horizontal" and "vertical" swap places in the id: It says I need to inflate horizontal_vertical_list_item, however; in the blue tip box it is referred to as vertical_horizontal_list_item and the file in the codelab raw source code is called vertical_horizontal_list_item.xml
Doggler_Typo

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: Dogglers app

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

In which task and step of the codelab can this issue be found?
4. Test your app

Describe the problem
4 of the 19 tests faill

For 3 of the tests, they all fail for the same reason.
The test is not handling the string resources with variables.
This happens for age and hobbies

<string name="dog_age">Age: %1$s</string>
<string name="dog_hobbies">Hobbies: %1$s</string>

But in BaseTest.hasListItemContent() you have this:

    onView(withText(age))
        .check(matches(isDisplayed()))
    onView(withText(hobbies))
        .check(matches(isDisplayed()))

This won't work because the actual TextView will be a like "Age: 7" and you can calling withText("7")

So to fix you can just do this:

  1. Add a private method so you don't duplicate your code (dry)

    private fun getResourceStringWithVariable(id: Int, variable: String): String? {
    val targetContext: Context = ApplicationProvider.getApplicationContext()
    return targetContext.getResources().getString(id, variable)
    }

  2. Fix your tests to be this:

     onView(withText(getResourceStringWithVariable(R.string.dog_age, age)))
         .check(matches(isDisplayed()))
     onView(withText(getResourceStringWithVariable(R.string.dog_hobbies, hobbies)))
         .check(matches(isDisplayed()))
    

The fourth test HorizontalListTests.horizontal_scrolling() is failing, because at least on on my emulator (pixel 5 api 31) if you do a swipeLeft you actually go inbetween the third and fourth card so the nama showing is from the fourth card "Nox" not the third card "Frankie" So instead of

fun `horizontal_scrolling`() {
    onView(withId(R.id.horizontal_recycler_view))
        .perform(swipeLeft())
    onView(withText("Nox")).check(matches(isDisplayed()))
}

it should be

fun `horizontal_scrolling`() {
    onView(withId(R.id.horizontal_recycler_view))
        .perform(swipeLeft())
    onView(withText("Nox")).check(matches(isDisplayed()))
}

Steps to reproduce?

  1. Run the tests and you can see 4 failing ones.

Versions
Android Studio Chipmunk | 2021.2.1 Patch 1
Build #AI-212.5712.43.2112.8609683, built on May 18, 2022
Runtime version: 11.0.12+0-b1504.28-7817840 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 4
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.intellij.plugins.markdown (212.5457.16), Dart (212.5744), io.flutter (69.0.2)

Additional information
Include screenshots if they would be useful in clarifying the problem.
Screen Shot 2022-07-09 at 4 51 17 PM

Android Basics: Wrong File name in Dogglers app

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

Describe the problem
"horizontal_vertical_list_item.xml" should be "vertical_horizontal_list_item.xml"
In one section of the instructions it says "horizontal_vertical_list_item.xml" but the actual file name is "vertical_horizontal_list_item.xml".

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.