Fixed
Status Update
Comments
sl...@google.com <sl...@google.com> #2
We are Facing this same issue after updating to compose 1.3.0 and also only on Android 9 Devices.
v....@gmail.com <v....@gmail.com> #3
Note: Some of the latest comments from b/212982463 could be relevant to this issue
ai...@gmail.com <ai...@gmail.com> #4
Hi, Is there any update on this. Any temp workaround would be helpful as well. Currently we have 10s of thousand users per day getting affected by this.
nk...@google.com <nk...@google.com>
ar...@gmail.com <ar...@gmail.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit e3164fbf4137f9cf60da424aef4b1d9ea5202b6c
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Dec 15 18:00:23 2022
Make our fake Views we use as graphic layer to save nothing as the View's saved instance state.
Because the Views were attached to the hierarchy and had an id their state was saved polluting the state Activity saves in Bundle. Such views have no real state as they are not used as real views.
Test: ComposeViewSavedStateSizeTest
Bug: 260322832
Change-Id: I0b755a3d6a164b6c26aa592e13e206dc45cd5dd9
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewSavedStateSizeTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/ViewLayer.android.kt
https://android-review.googlesource.com/2359699
Branch: androidx-main
commit e3164fbf4137f9cf60da424aef4b1d9ea5202b6c
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Dec 15 18:00:23 2022
Make our fake Views we use as graphic layer to save nothing as the View's saved instance state.
Because the Views were attached to the hierarchy and had an id their state was saved polluting the state Activity saves in Bundle. Such views have no real state as they are not used as real views.
Test: ComposeViewSavedStateSizeTest
Bug: 260322832
Change-Id: I0b755a3d6a164b6c26aa592e13e206dc45cd5dd9
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/platform/ComposeViewSavedStateSizeTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/ViewLayer.android.kt
nk...@google.com <nk...@google.com> #6
Project: platform/frameworks/support
Branch: androidx-main
commit 326b394002e0f899fdc0bffc622761bc67bca21b
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Dec 15 16:16:31 2022
Destroy layers added on the nodes when the node is removed
Currently the layer objects are not being removed from the AndroidComposeView in this situation, which means we are not reusing the layers and we keep them attached until the whole AndroidComposeView is not garbage collected.
Test: new test in MeasureAndLayoutDelegateTest
Bug: 260322832
Change-Id: Iaeee5662b4646230cebdafd2484c691df657edda
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/Helpers.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/MeasureAndLayoutDelegateTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt
https://android-review.googlesource.com/2359119
Branch: androidx-main
commit 326b394002e0f899fdc0bffc622761bc67bca21b
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Dec 15 16:16:31 2022
Destroy layers added on the nodes when the node is removed
Currently the layer objects are not being removed from the AndroidComposeView in this situation, which means we are not reusing the layers and we keep them attached until the whole AndroidComposeView is not garbage collected.
Test: new test in MeasureAndLayoutDelegateTest
Bug: 260322832
Change-Id: Iaeee5662b4646230cebdafd2484c691df657edda
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/Helpers.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/layout/MeasureAndLayoutDelegateTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeCoordinator.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/NodeKind.kt
be...@gmail.com <be...@gmail.com> #8
Hi there! Most likely next release of Compose UI, by mid January. Cheers.
fr...@gmail.com <fr...@gmail.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui:1.3.3
androidx.compose.ui:ui:1.4.0-alpha04
xa...@gmail.com <xa...@gmail.com> #10
Issue is still existing with the same rate in 1.3.3 and similar reproduction steps. Since this ticket is already set as fixed, should we file a new bug?
vi...@gmail.com <vi...@gmail.com> #11
Hey. Please check that you can reproduce the same issue with the latest 1.4 release and if yes please file a new bug. Thanks
to...@gmail.com <to...@gmail.com> #13
It's been about a month. When will the v1.0 release of Rules/Runner be released?
to...@gmail.com <to...@gmail.com> #15
We just tried to update our runner/rules, but test suite crashed :) I guess we may need to update Espresso to 3.0 as well.
jc...@gmail.com <jc...@gmail.com> #16
Any updates on this bug? Is this fixed?
nk...@google.com <nk...@google.com> #17
Yes, this was fixed for a while now. Please give it a try with the latest version of our libraries.
da...@gmail.com <da...@gmail.com> #19
Any other updates about this bug? I'm still issuing it with:
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test:rules:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Tests always passes individually.
Running the suite instead, they have an unpredictable behavior: sometimes they passes, sometimes do not.
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test:rules:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Tests always passes individually.
Running the suite instead, they have an unpredictable behavior: sometimes they passes, sometimes do not.
gu...@gmail.com <gu...@gmail.com> #20
For some reason with databinding and static class I cannot debug code in ViewModel at every 2 test. Individually everything is just fine. espresso 3.0.2
gu...@gmail.com <gu...@gmail.com> #21
This is works like this (everything is without package). In my View which is Activity I call onStart() and onPause() of ViewModel. In xml I have button with enabled set to MutableLiveData<Boolean> property in ViewModel. I write in Kotlin
//This is button enabled field update, each time when this MutableLiveData<Boolean> is called it prints this.toString()
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
//Second test start onStart() of ViewModel
START: PersonalViewModel@43321e0
PersonalViewModel@43321e0 //Calls button MutableLiveData<Boolean> for enabled property only ONCE
//Second test onPause() of ViewModel
PAUSE: PersonalViewModel@43321e0
//Third test start onStart() of ViewModel
START: PersonalViewModel@dc72c50
PersonalViewModel@dc72c50 //Calls button MutableLiveData<Boolean> for enabled property only ONCE
PAUSE: PersonalViewModel@dc72c50
When the second test starts it seems like it calls MutableLiveData<Boolean> property only once for button and then it fails to bind or something, because button is not updating anymore. Individually all tests work.
//This is button enabled field update, each time when this MutableLiveData<Boolean> is called it prints this.toString()
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
PersonalViewModel@52cb180
//Second test start onStart() of ViewModel
START: PersonalViewModel@43321e0
PersonalViewModel@43321e0 //Calls button MutableLiveData<Boolean> for enabled property only ONCE
//Second test onPause() of ViewModel
PAUSE: PersonalViewModel@43321e0
//Third test start onStart() of ViewModel
START: PersonalViewModel@dc72c50
PersonalViewModel@dc72c50 //Calls button MutableLiveData<Boolean> for enabled property only ONCE
PAUSE: PersonalViewModel@dc72c50
When the second test starts it seems like it calls MutableLiveData<Boolean> property only once for button and then it fails to bind or something, because button is not updating anymore. Individually all tests work.
Description
Version used: 2.2.1
What steps will reproduce the problem?
1. Have atleast 3 tests
2. Log messages in activity onCreate and onDestroy
3. Observe onCreate -> onDestroy messages not going in order (onCreate -> onDestroy, onCreate -> onDestroy, onCreate -> onDestroy)
How are you running your tests (via Android Studio, Gradle, adb, etc.)?
Android Studio 1.5.1
What is the expected output? What do you see instead?
Log messages going sequentially (onCreate -> onDestroy, onCreate -> onDestroy, onCreate -> onDestroy)
I am trying to use espresso and junit4. The problem seems to be that I have code that is statically initialized in activity.onCreate and deinitialized in activity.onDestroy to prevent leaks, etc.
Now when I run espresso, the tests seem to run in "parallel". I added log class to activity onCreate and onDestroy.
What I am seeing is
onCreate = example.package.MainActivity@ABC
onCreate = example.package.MainActivity@JKL
onDestroy = example.package.MainActivity@ABC
onCreate = example.package.MainActivity@XYZ
onDestroy = example.package.MainActivity@JKL
onDestroy = example.package.MainActivity@XYZ
**and ofcourse it fails on NPE in third test because the second test's onDestroy ran after third's onCreate (which null-ed out the static code)**
Is this behaviour normal? Can I force espresso to teardown activity instance first and only then start a new one? Thanks!