Status Update
Comments
jb...@google.com <jb...@google.com>
an...@google.com <an...@google.com> #2
reemission of the same liveData is racy
il...@google.com <il...@google.com> #3
an...@google.com <an...@google.com> #4
my...@gmail.com <my...@gmail.com> #5
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
ta...@gmail.com <ta...@gmail.com> #6
[Deleted User] <[Deleted User]> #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} )
}
mi...@gmail.com <mi...@gmail.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
[Deleted User] <[Deleted User]> #9
P.S. Why it wasn't possible to fix the issue before releasing stable?
Adding @Keep manually sounds like it is 2015 now developers should struggle with their own set of rules for every single components.
ey...@gmail.com <ey...@gmail.com> #10
Disabling the lint check is one thing, but lots of developers heard about this being the way forward for embedded fragments. They would probably assume that it would work with R8 (like I did), and possibly cause a crash in a production app (like I did; luckily in a pre release build).
ap...@google.com <ap...@google.com> #11
Branch: master
commit 4bdc698d9f8fb4f85464d554cabeb954104ec0a3
Author: Jeremy Woods <jbwoods@google.com>
Date: Fri Feb 28 19:42:38 2020
Generate "keep" rules for android:name and class attributes
We should keep classes that are in the android:name or class xml
attributes.
Test: m -j aapt2_tests
Bug: 142601969
Change-Id: Ia67365bd702bae75d38b9572d68e9930e856e0f8
M tools/aapt2/java/ProguardRules.cpp
M tools/aapt2/java/ProguardRules_test.cpp
jb...@google.com <jb...@google.com> #12
This has been fixed internally, and should be available in the Android Gradle Plugin 4.1-alpha04 release.
my...@gmail.com <my...@gmail.com> #13
Will it get backported to 3.6 and 4.0?
im...@google.com <im...@google.com> #14
You can do it in two ways, with the first approach being much safer:
1) In your build.gradle force gradle to use the newer version:
configurations.matching {
config.resolutionStrategy.eachDependency { details ->
details.useVersion("4.1.0-alpha04-6296993")
}
}
2) If for some reason the above doesn't work, you can manually download the gmaven jar file for "com.android.tools.build:aapt2:4.1.0-alpha04-6296993" (
Note: check the version when it comes out, most likely it should match this but it's possible we update the prebuilts again before then. 4.1 canary 4 is not out yet, so this will only be available in gmaven once that canary is released.
ka...@gmail.com <ka...@gmail.com> #15
Can you add the alpha releases and their notes to the Android Gradle Plugin releases page? There's currently no mention of 4.1 on
e....@gmail.com <e....@gmail.com> #16
ga...@gtempaccount.com <ga...@gtempaccount.com> #17
This has not been fixed in 4.1.0, you need to use a workaround like
il...@google.com <il...@google.com> #18
Re #17 - this certainly has been fixed and verified when using Android Gradle Plugin 4.1.0 or higher. If you're seeing differently, please attach a sample project that reproduces your issue.
Description
Version used: 1.2.0-beta02
Devices/Android versions reproduced on: all
When the only reference to a Fragment is via a FragmentContainerView's android:name, it seems like ProGuard strips the class out, causing crashes in release builds. I expected it to work just like the <fragment> tag in that the class would automatically be kept.
Reproduction steps:
1) Check out Muzei's v3.3.0-beta2 tag
2) Add minifyEnabled true to the debug type in main/build.gradle
3) Build a debug APK / bundle
4) Inspect the dex output and note that the AutoAdvanceFragment (used in the choose_provider_fragment.xml layout) does not exist.
Switching back to <fragment> fixes the issue.