Status Update
Comments
il...@google.com <il...@google.com> #2
reemission of the same liveData is racy
vs...@gmail.com <vs...@gmail.com> #3
il...@google.com <il...@google.com>
jd...@gmail.com <jd...@gmail.com> #4
zh...@google.com <zh...@google.com> #5
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
zh...@google.com <zh...@google.com> #6
jd...@gmail.com <jd...@gmail.com> #7
I actually have a WIP fix for it:
if your case is the one i found (emitting same LiveData multiple times, as shown in #5) you can work around it by adding a dummy transformation.
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData.map {it })
emitSource(subLiveData.map {it} )
}
ap...@google.com <ap...@google.com> #8
Branch: androidx-master-dev
commit af12e75e6b4110f48e44ca121466943909de8f06
Author: Yigit Boyar <yboyar@google.com>
Date: Tue Sep 03 12:58:11 2019
Fix coroutine livedata race condition
This CL fixes a bug in liveData builder where emitting same
LiveData source twice would make it crash because the second
emission registry could possibly happen before first one is
removed as source.
We fix it by using a suspending dispose function. It does feel
a bit hacky but we cannot make DisposableHandle.dispose async
and we do not want to block there. This does not mean that there
is a problem if developer disposes it manually since our emit
functions take care of making sure it disposes (and there is
no other way to add source to the underlying MediatorLiveData)
Bug: 140249349
Test: BuildLiveDataTest#raceTest_*
Change-Id: I0b464c242a583da4669af195cf2504e2adc4de40
M lifecycle/lifecycle-livedata-ktx/api/2.2.0-alpha05.txt
M lifecycle/lifecycle-livedata-ktx/api/current.txt
M lifecycle/lifecycle-livedata-ktx/api/public_plus_experimental_2.2.0-alpha05.txt
M lifecycle/lifecycle-livedata-ktx/api/public_plus_experimental_current.txt
M lifecycle/lifecycle-livedata-ktx/api/restricted_2.2.0-alpha05.txt
M lifecycle/lifecycle-livedata-ktx/api/restricted_current.txt
M lifecycle/lifecycle-livedata-ktx/src/main/java/androidx/lifecycle/CoroutineLiveData.kt
M lifecycle/lifecycle-livedata-ktx/src/test/java/androidx/lifecycle/BuildLiveDataTest.kt
jb...@google.com <jb...@google.com> #9
This has been fixed internally and will be available in the next Activity release.
vs...@gmail.com <vs...@gmail.com> #10
Awesome, thank you!
ba...@gmail.com <ba...@gmail.com> #11
to...@yahoo.com <to...@yahoo.com> #12
[Deleted User] <[Deleted User]> #13
ce...@gmail.com <ce...@gmail.com> #14
Release notes of
We still get it with Activity 1.2.2 and Fragment 1.3.2.
to...@yahoo.com <to...@yahoo.com> #15
implementation 'androidx.fragment:fragment:1.3.2'
finally seems to work...
ce...@gmail.com <ce...@gmail.com> #16
Edit for
The issue is fixed.
I'm sorry for the previous message, the issue was caused by the dependency configuration of our project (some modules had a transitive dependency on previous activity/fragment versions).
lb...@gmail.com <lb...@gmail.com> #17
il...@google.com <il...@google.com> #18
Upgrading to Activity 1.2.2 (or Activity 1.3.0-alpha05, which also includes the fix) is the only requirement.
Fragment 1.3.2 includes a dependency on Activity 1.2.2, so upgrading your version of Fragments will also pull in the fix via the transitive dependency.
lb...@gmail.com <lb...@gmail.com> #19
implementation "androidx.fragment:fragment-ktx:1.3.2"
?
But how do you guys know this fixed the issue?
lb...@gmail.com <lb...@gmail.com> #21
ca...@gmail.com <ca...@gmail.com> #22
```
Update to Fragment 1.3.0 to use ActivityResult APIs
```
il...@google.com <il...@google.com> #23
Re #22 - please file a new bug with a sample project that reproduces your issue.
ar...@gmail.com <ar...@gmail.com> #24
ar...@gmail.com <ar...@gmail.com> #25
ar...@gmail.com <ar...@gmail.com> #26
du...@gmail.com <du...@gmail.com> #27
il...@google.com <il...@google.com> #28
Re #24-27 - please file a new issue with a project that reproduces your issue.
mu...@gmail.com <mu...@gmail.com> #29
mu...@gmail.com <mu...@gmail.com> #30
ig...@gmail.com <ig...@gmail.com> #31
implementation "androidx.activity:activity-ktx:
implementation "androidx.fragment:fragment-ktx:1.3.4"
il...@google.com <il...@google.com> #32
Re #29, #31 - like previously mentioned, file a new issue with a project that reproduces your issue.
si...@gmail.com <si...@gmail.com> #33
df...@smart-soft.com <df...@smart-soft.com> #34
il...@google.com <il...@google.com> #35
Re
Description
Component used: Activity
Version used: 1.3.0-alpha04
InvalidFragmentVersionForActivityResult
is reported though I forcedandroidx.fragment:fragment-ktx:1.3.1
.Here is my build.gradle essentials: