Status Update
Comments
cl...@google.com <cl...@google.com> #2
Branch: androidx-master-dev
commit c60f33e229e31ab328ef6b59dab63b264954831c
Author: Alexandre Elias <aelias@google.com>
Date: Fri Jul 10 16:23:09 2020
Semantics no-op cleanups
Partly in response to lmr's broad code review, I did a pass of
superficial API/implementation cleanup. The main changes are:
- I changed each Boolean SemanticsProperty where false is equivalent to
not being present to take "Unit" instead. This is conceptually
clearer: it avoids questions like "can I cancel out a semantics from a
merged child by setting it to false?" Because "property = Unit" looks
weird, I also changed the style of these to "property()".
- I moved the Semantics id generator closer to where it's used, in
SemanticsModifierCore. I made it internal and an AtomicInt.
(Note that integer ids are heavily used in the Android
AccessibilityNodeInfo APIs so I can't simply remove them entirely.)
- I deleted dead code. Some examples include SemanticsHintOverrides,
a public API not connected to anything, and SemanticsPropertyKey
merge() open method which is never called. (In both cases I have
a different plan in mind for accessibility.)
Fixes: 145951226
Fixes: 145955412
Test: existing tests
Relnote: "Single-value semantics properties now use a calling style.
For example, 'semantics { hidden = true }' is now written as:
'semantics { hidden() }'."
Change-Id: Ic1afd12ea22c926babc9662f1804d80b33aa0cfc
M ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/LayoutNodeModifierBenchmark.kt
M ui/ui-core/api/0.1.0-dev15.txt
M ui/ui-core/api/current.txt
M ui/ui-core/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-core/api/public_plus_experimental_current.txt
M ui/ui-core/api/restricted_0.1.0-dev15.txt
M ui/ui-core/api/restricted_current.txt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/graphics/vector/VectorTest.kt
M ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/semantics/SemanticsTests.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidActuals.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeView.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidComposeViewAccessibilityDelegateCompat.kt
M ui/ui-core/src/androidMain/kotlin/androidx/ui/core/AndroidPopup.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/Expect.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsConfiguration.kt
D ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsHintOverrides.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsModifier.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsNode.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsOwner.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/core/semantics/SemanticsWrapper.kt
M ui/ui-core/src/commonMain/kotlin/androidx/ui/semantics/SemanticsProperties.kt
M ui/ui-foundation/api/0.1.0-dev15.txt
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_0.1.0-dev15.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Dialog.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/Scroller.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Selectable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/selection/Toggleable.kt
M ui/ui-foundation/src/main/java/androidx/ui/foundation/semantics/FoundationSemanticsProperties.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CardTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/CheckboxScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/RadioButtonScreenshotTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/SurfaceTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
M ui/ui-material/src/androidTest/java/androidx/ui/material/textfield/TextFieldScreenshotTest.kt
M ui/ui-material/src/main/java/androidx/ui/material/AppBar.kt
M ui/ui-material/src/main/java/androidx/ui/material/TextFieldImpl.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/AssertsTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/CallSemanticsActionTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ErrorMessagesTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/FindersTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/PrintToStringTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/ScrollToTest.kt
M ui/ui-test/src/androidTest/java/androidx/ui/test/TextActionsTest.kt
M ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
M ui/ui-test/src/main/java/androidx/ui/test/Filters.kt
M ui/ui-text/api/0.1.0-dev15.txt
M ui/ui-text/api/current.txt
M ui/ui-text/api/public_plus_experimental_0.1.0-dev15.txt
M ui/ui-text/api/public_plus_experimental_current.txt
M ui/ui-text/api/restricted_0.1.0-dev15.txt
M ui/ui-text/api/restricted_current.txt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/CoreTextField.kt
M ui/ui-text/src/commonMain/kotlin/androidx/ui/text/TextSemanticsProperties.kt
kh...@gmail.com <kh...@gmail.com> #3
ad...@guardian.co.uk <ad...@guardian.co.uk> #4
Getting the same issue in our JVM tests. The test is for a data mapper where input data is provided using PagingData.from(...)
and the output is checked using asSnapshot()
.
This test works fine as a JVM test on 3.2
.
Stacktrace:
java.lang.UnsatisfiedLinkError: 'boolean android.util.Log.isLoggable(java.lang.String, int)'
at android.util.Log.isLoggable(Native Method)
at androidx.paging.PagingLogger.isLoggable(PagingLogger.android.kt:29)
at androidx.paging.PagingDataPresenter$collectFrom$2$1.emit(PagingDataPresenter.kt:521)
at androidx.paging.PagingDataPresenter$collectFrom$2$1.emit(PagingDataPresenter.kt:118)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:11)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:11)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:113)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:82)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1$2.emit(CachedPageEventFlow.kt:105)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1$2.emit(CachedPageEventFlow.kt:102)
at kotlinx.coroutines.flow.FlowKt__LimitKt$takeWhile$lambda$6$$inlined$collectWhile$1.emit(Limit.kt:140)
at kotlinx.coroutines.flow.SubscribedFlowCollector.emit(Share.kt)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:392)
at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(SharedFlow.kt)
at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:42)
at androidx.paging.SingleRunner.runInIsolation(SingleRunner.kt:49)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1$1.invokeSuspend(PagerFlowSnapshot.kt:119)
at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:213)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:30)
at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:56)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1.invokeSuspend(PagerFlowSnapshot.kt:117)
at com.theguardian.myguardian.followed.feed.list.ListContentUiStateTest$when data is emitted from source then it is mapped to blueprint rows$1.invokeSuspend(ListContentUiStateTest.kt:73)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$1.invokeSuspend(TestBuilders.kt:316)
Caused by: java.lang.UnsatisfiedLinkError: 'boolean android.util.Log.isLoggable(java.lang.String, int)'
at android.util.Log.isLoggable(Native Method)
at androidx.paging.PagingLogger.isLoggable(PagingLogger.android.kt:29)
at androidx.paging.PagingDataPresenter$collectFrom$2$1.emit(PagingDataPresenter.kt:521)
at androidx.paging.PagingDataPresenter$collectFrom$2$1.emit(PagingDataPresenter.kt:118)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:11)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:11)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:113)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:82)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1$2.emit(CachedPageEventFlow.kt:105)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1$2.emit(CachedPageEventFlow.kt:102)
at kotlinx.coroutines.flow.FlowKt__LimitKt$takeWhile$lambda$6$$inlined$collectWhile$1.emit(Limit.kt:140)
at kotlinx.coroutines.flow.SubscribedFlowCollector.emit(Share.kt)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:392)
at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(SharedFlow.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.test.TestDispatcher.processEvent$kotlinx_coroutines_test(TestDispatcher.kt:24)
at kotlinx.coroutines.test.TestCoroutineScheduler.tryRunNextTaskUnless$kotlinx_coroutines_test(TestCoroutineScheduler.kt:99)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$workRunner$1.invokeSuspend(TestBuilders.kt:322)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:48)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at kotlinx.coroutines.test.TestBuildersJvmKt.createTestResult(TestBuildersJvm.kt:10)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0(TestBuilders.kt:310)
at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0(Unknown Source)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0(TestBuilders.kt:168)
at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0(Unknown Source)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest-8Mi8wO0$default(TestBuilders.kt:160)
at kotlinx.coroutines.test.TestBuildersKt.runTest-8Mi8wO0$default(Unknown Source)
at com.theguardian.myguardian.followed.feed.list.ListContentUiStateTest.when data is emitted from source then it is mapped to blueprint rows(ListContentUiStateTest.kt:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.mockito.internal.runners.DefaultInternalRunner$1$1.evaluate(DefaultInternalRunner.java:55)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.mockito.internal.runners.DefaultInternalRunner$1.run(DefaultInternalRunner.java:100)
at org.mockito.internal.runners.DefaultInternalRunner.run(DefaultInternalRunner.java:107)
at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:42)
at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:112)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:40)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:60)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:52)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at jdk.proxy1/jdk.proxy1.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$2.run(TestWorker.java:176)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
cl...@google.com <cl...@google.com> #5
It seems the problem here is using paging-runtime 3.2.x
along with paging-common 3.3.0
.
You likely see this error here because paging-common 3.3.0
(along with paging-compose / paging-testing) was commonized into kmp structure.
In the stacktrace you'll notice the file name PagingLogger.android.kt:29
has an android.kt
suffix, meaning it was intended only for android platform (androidTests
).
Re:androidTest
and see if it passes, or upload a sample app?
We should probably add a constraint to ensure paging-common 3.3.0
is used with paging-runtime 3.3.0
ad...@guardian.co.uk <ad...@guardian.co.uk> #6
Hey!
You were right, there were different minor versions - paging-runtime 3.2.1
and paging-compose 3.3.0
. However, updating both to 3.3.0
didn't fix the test issue either.
The tests do pass when running in an androidTest
.
Does this mean that all paging related tests now need to run as androidTest
s instead of jvm test
s? That'd be a bummer with the cost and time of instrumented tests :(
kf...@gmail.com <kf...@gmail.com> #8
Hi, I have the same issue since androidx.paging:paging-runtime:3.3.0
and androidx.paging:paging-testing:3.3.0
.
Here is a sample test that fails:
@Test
fun asSnapshot() = runTest {
val data = listOf(1, 2, 3)
val pagingData = PagingData.from(data)
val pagingDataStream = flowOf(pagingData)
val result = pagingDataStream.asSnapshot()
assertEquals(data, result)
}
Method isLoggable in android.util.Log not mocked. See https://developer.android.com/r/studio-ui/build/not-mocked for details.
java.lang.RuntimeException: Method isLoggable in android.util.Log not mocked. See https://developer.android.com/r/studio-ui/build/not-mocked for details.
at android.util.Log.isLoggable(Log.java)
at androidx.paging.PagingLogger.isLoggable(PagingLogger.android.kt:29)
at androidx.paging.PagingDataPresenter$collectFrom$2$1.emit(PagingDataPresenter.kt:521)
at androidx.paging.PagingDataPresenter$collectFrom$2$1.emit(PagingDataPresenter.kt:118)
at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$2.collect(SafeCollector.common.kt:112)
at androidx.paging.PagingDataPresenter$collectFrom$2.invokeSuspend(PagingDataPresenter.kt:118)
at androidx.paging.PagingDataPresenter$collectFrom$2.invoke(PagingDataPresenter.kt)
at androidx.paging.PagingDataPresenter$collectFrom$2.invoke(PagingDataPresenter.kt)
at androidx.paging.SingleRunner$runInIsolation$2.invokeSuspend(SingleRunner.kt:59)
at androidx.paging.SingleRunner$runInIsolation$2.invoke(SingleRunner.kt)
at androidx.paging.SingleRunner$runInIsolation$2.invoke(SingleRunner.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
at androidx.paging.SingleRunner.runInIsolation(SingleRunner.kt:49)
at androidx.paging.SingleRunner.runInIsolation$default(SingleRunner.kt:44)
at androidx.paging.PagingDataPresenter.collectFrom(PagingDataPresenter.kt:116)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1$1.invokeSuspend(PagerFlowSnapshot.kt:119)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1$1.invoke(PagerFlowSnapshot.kt)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1$1.invoke(PagerFlowSnapshot.kt)
at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:213)
at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Merge.kt)
at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Merge.kt)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:30)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:27)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:90)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:52)
at kotlinx.coroutines.BuildersKt.launch(Unknown Source)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:43)
at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1.emit(Merge.kt:29)
at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$2.collect(SafeCollector.common.kt:112)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invokeSuspend(Merge.kt:23)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(Merge.kt)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3.invoke(Merge.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest.flowCollect(Merge.kt:21)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:153)
at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(ChannelFlow.kt)
at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:56)
at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:42)
at androidx.paging.SingleRunner.runInIsolation(SingleRunner.kt:49)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1$1.invokeSuspend(PagerFlowSnapshot.kt:119)
at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:213)
at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:30)
at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:56)
at androidx.paging.testing.PagerFlowSnapshotKt$asSnapshot$4$collectPagingData$1.invokeSuspend(PagerFlowSnapshot.kt:117)
As a workaround, it does work as an instrumented test.
However, it should still work as a local test and should not depend on the Android framework.
cl...@google.com <cl...@google.com> #9
As a quick update, the core cause of this issue is that in 3.3.0
paging was commonized to support Kotlin Multiplatform.
As a result, when an android project depends on Paging 3.3, it pulls in the android implementation for the main source as well as android unit tests. Hence you see PagingLogger.android.kt
in the stacktrace.
at androidx.paging.PagingLogger.isLoggable(PagingLogger.android.kt:29)
This will need to be fixed on our end so that unit tests do not trigger logs.
le...@gmail.com <le...@gmail.com> #10
Thanks a lot.
cl...@google.com <cl...@google.com> #11
While we work on the fix, here are a few workarounds in the meantime. Either option works:
- Make your project KMP and put paging tests in jvmTest
- Use Robolectric in your androidTest to run the tests as is
- Move the tests to instrumented androidTest and run the tests with emulator
ad...@guardian.co.uk <ad...@guardian.co.uk> #12
Thanks Clara!
"While we work on the fix... " - Does this mean we can expect this to be resolved in near future to work with non-KMP projects in regular jvm tests?
Migrating to KMP is a larger task and beyond our scope. Introducing Roboelectric just for paging tests also feels excessive.
Moving the tests to androidTest
feels like a reasonable approach in the moment. The only issue with this is that instrumented tests are slow and expensive, and once we move these tests there, we're quite likely to forget about ever moving them back to jvm.
If there's a solution for jvm tests without KMP in sight, we'd rather continue holding back from upgrading to 3.3.x
rather than migrate to androidTests.
It there's no change expected anytime soon (as Ian suggested in another channel), then we'd rather to bite the bullet now and migrate to androidTest
.
cl...@google.com <cl...@google.com> #13
Yup I get where you're coming from. I'm looking into makings the logs no-op in android tests (or making it optional) to remove the burden from developers. Not sure how viable this is though but if a fix on our end is possible, it will be released in 3.3.4
.
ap...@google.com <ap...@google.com> #14
Project: platform/frameworks/support
Branch: androidx-main
Author: Clara Fok <
Link:
Disable Paging logs on android unit tests
Expand for full commit details
Disable Paging logs on android unit tests
Non-kmp projects pulling in Paging 3.3 or later will automatically pull in android dependencies for android unit tests. This is by nature of how multiplatform sources are resolved.
Paging logger is an android dependency that requires instrumented tests or robolectric. As such it throws in non-instrumented unit tests. This CL checks os BUILD id and disables logging if null. This does not affect instrumented tests or robolectric tests as the ID in either case is non-null.
Test: existing tests pass
Bug: 331684448
Relnote: "Android unit tests pulling in Paging 3.3 or later will no longer throw from PagingLogger"
Change-Id: Ia9400db995e7f0357cae2647cbd2cef9cf6c3398
Files:
- M
paging/paging-common/src/androidMain/kotlin/androidx/paging/PagingLogger.android.kt
Hash: 77041951f769c8e98a60da2dbe540505d98084ad
Date: Wed Oct 30 17:21:10 2024
cl...@google.com <cl...@google.com> #15
Fixed internally and will be available in paging 3.3.4
ad...@guardian.co.uk <ad...@guardian.co.uk> #16
--
This e-mail and all attachments are confidential and may also be
privileged. If you are not the named recipient, please notify the sender
and delete the e-mail and all attachments immediately. Do not disclose the
contents to another person. You may not use the information for any
purpose, or store, or copy, it in any way. Guardian News & Media Limited
is not liable for any computer viruses or other material transmitted with
or as part of this e-mail. You should employ virus checking software.
Guardian News & Media Limited is a member of Guardian Media Group plc.
Registered Office: PO Box 68164, Kings Place, 90 York Way, London, N1P 2AP.
Registered in England Number 908396
na...@google.com <na...@google.com> #17
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.paging:paging-common:3.3.4
androidx.paging:paging-common-android:3.3.4
androidx.paging:paging-common-iosarm64:3.3.4
androidx.paging:paging-common-iossimulatorarm64:3.3.4
androidx.paging:paging-common-iosx64:3.3.4
androidx.paging:paging-common-jvm:3.3.4
androidx.paging:paging-common-linuxarm64:3.3.4
androidx.paging:paging-common-linuxx64:3.3.4
androidx.paging:paging-common-macosarm64:3.3.4
androidx.paging:paging-common-macosx64:3.3.4
androidx.paging:paging-common-tvosarm64:3.3.4
androidx.paging:paging-common-tvossimulatorarm64:3.3.4
androidx.paging:paging-common-tvosx64:3.3.4
androidx.paging:paging-common-watchosarm32:3.3.4
androidx.paging:paging-common-watchosarm64:3.3.4
androidx.paging:paging-common-watchossimulatorarm64:3.3.4
androidx.paging:paging-common-watchosx64:3.3.4
Description
Version used: 3.2.1
Devices/Android versions reproduced on: it's in unit-test
here is the error log
```
java.lang.RuntimeException: Method isLoggable in android.util.Log not mocked. See
at android.util.Log.isLoggable(Log.java)
at androidx.paging.AsyncPagingDataDiffer$Companion$1.isLoggable(AsyncPagingDataDiffer.kt:433)
at androidx.paging.PagingDataDiffer$collectFrom$2$1.emit(PagingDataDiffer.kt:555)
at androidx.paging.PagingDataDiffer$collectFrom$2$1.emit(PagingDataDiffer.kt:140)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1$2.emit(CachedPageEventFlow.kt:106)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1$2.emit(CachedPageEventFlow.kt:103)
at kotlinx.coroutines.flow.FlowKt__LimitKt$takeWhile$lambda$6$$inlined$collectWhile$1.emit(Limit.kt:143)
at kotlinx.coroutines.flow.SubscribedFlowCollector.emit(Share.kt)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:382)
at kotlinx.coroutines.flow.SharedFlowImpl.collect(SharedFlow.kt)
at kotlinx.coroutines.flow.SubscribedSharedFlow.collect(Share.kt:409)
at kotlinx.coroutines.flow.FlowKt__LimitKt$takeWhile$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:125)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1.invokeSuspend(CachedPageEventFlow.kt:103)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1.invoke(CachedPageEventFlow.kt)
at androidx.paging.CachedPageEventFlow$downstreamFlow$1.invoke(CachedPageEventFlow.kt)
at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:121)
at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:115)
at androidx.paging.PagingDataDiffer$collectFrom$2.invokeSuspend(PagingDataDiffer.kt:140)
at androidx.paging.PagingDataDiffer$collectFrom$2.invoke(PagingDataDiffer.kt)
at androidx.paging.PagingDataDiffer$collectFrom$2.invoke(PagingDataDiffer.kt)
at androidx.paging.SingleRunner$runInIsolation$2.invokeSuspend(SingleRunner.kt:59)
at androidx.paging.SingleRunner$runInIsolation$2.invoke(SingleRunner.kt)
at androidx.paging.SingleRunner$runInIsolation$2.invoke(SingleRunner.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:264)
at androidx.paging.SingleRunner.runInIsolation(SingleRunner.kt:49)
at androidx.paging.SingleRunner.runInIsolation$default(SingleRunner.kt:44)
at androidx.paging.PagingDataDiffer.collectFrom(PagingDataDiffer.kt:138)
at androidx.paging.AsyncPagingDataDiffer.submitData(AsyncPagingDataDiffer.kt:229)
```