Status Update
Comments
tp...@gmail.com <tp...@gmail.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
il...@google.com <il...@google.com> #3
du...@google.com <du...@google.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
tp...@gmail.com <tp...@gmail.com> #5
Hi, no we are not using during instrumented test but just a normal run from AS will encounter the crash.
Not sure what went wrong but excluding the transitive dependency group androidx.paging from room-paging seems to work and androidx.paging:paging-common:3.1.1 no longer shown as strictly in the app:dependencies task.
il...@google.com <il...@google.com> #6
If you're able to reproduce this in a sample project, please attach it here and we can reopen the issue and take a look.
fr...@gmail.com <fr...@gmail.com> #7
I also ran into this, it is fairly easy to reproduce on my end. I need to add dependency on both paging-runtime
and paging-compose
:
implementation 'androidx.paging:paging-runtime:3.1.1'
implementation 'androidx.paging:paging-compose:1.0.0-alpha15'
And then eg. creating a PagingDataAdapter
will cause a crash:
val adapter = object : PagingDataAdapter<String, RecyclerView.ViewHolder>(object : DiffUtil.ItemCallback<String>() {
override fun areItemsTheSame(oldItem: String, newItem: String) = true
override fun areContentsTheSame(oldItem: String, newItem: String) = true
}) {
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) = TODO()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = TODO()
}
java.lang.NoSuchMethodError: No direct method <init>(Landroidx/paging/DifferCallback;Lkotlinx/coroutines/CoroutineDispatcher;)V in class Landroidx/paging/PagingDataDiffer; or its super classes (declaration of 'androidx.paging.PagingDataDiffer' appears in /data/app/~~QVBQXUo_41J0PPyeyQkLkA==/com.example.pagingcrashrepro-b6_Qq8aKQlwtI2MEGllfnw==/base.apk)
at androidx.paging.AsyncPagingDataDiffer$differBase$1.<init>(AsyncPagingDataDiffer.kt:78)
at androidx.paging.AsyncPagingDataDiffer.<init>(AsyncPagingDataDiffer.kt:78)
at androidx.paging.PagingDataAdapter.<init>(PagingDataAdapter.kt:78)
at androidx.paging.PagingDataAdapter.<init>(PagingDataAdapter.kt:61)
at com.example.pagingcrashrepro.MainActivity$onCreate$adapter$1.<init>(MainActivity.kt:17)
at com.example.pagingcrashrepro.MainActivity.onCreate(MainActivity.kt:17)
at android.app.Activity.performCreate(Activity.java:8054)
at android.app.Activity.performCreate(Activity.java:8034)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1341)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3666)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3842)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2252)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
If I downgrade paging dependency to alpha14
, the crash does not happen.
du...@google.com <du...@google.com> #8
You must use paging 3.2.0-alpha01
with paging-compose:1.0.0-alpha15
.
fr...@gmail.com <fr...@gmail.com> #9
You must use paging
3.2.0-alpha01
withpaging-compose:1.0.0-alpha15
.
Ok, then I have a couple of follow ups, in no particular order:
- Is this documented somewhere?
- Why does it not fail at compile time, instead of runtime?
- Why doesn't
paging-compose:1.0.0-alpha15
then force the other dependency to update to3.2.0-alpha01
? - If there is no other way that to fail at runtime, could there be a better error message at least?
il...@google.com <il...@google.com> #10
Re
If you have a sample project where you are not seeing that happen automatically, please attach it here.
il...@google.com <il...@google.com> #12
This is more of an issue with Gradle than anything else - leaving out the dependency on paging-runtime
would automatically upgrade you to the correct version of paging-common
, but your explicit dependency overrides that default behavior.
Gradle does offer the ability to set constrants, which would help enforce this even if you do explicitly set the wrong version. We can add that between paging-common
and paging-compose
.
ap...@google.com <ap...@google.com> #13
Branch: androidx-main
commit e44aa3ffaf00622674ef7dec7ad63be0b03b3f16
Author: Clara Fok <clarafok@google.com>
Date: Tue Jul 19 16:59:26 2022
Add project dependency constraint between paging-common and paging runtime
Added bi-directional project version constraint between paging-common and paging-runtime. If both artifacts are in the dependency tree,
they would have to be on the same version. This is enforced by gradle automatically bumping up the version to meet constraint.
Before constraint added, with direct dependency on paging-runtime:3.1.1 and paging-common:3.2.0-alpha02
+--- androidx.paging:paging-runtime:3.1.1
| +--- androidx.paging:paging-common:3.1.1 -> 3.2.0-alpha02
After constraint with direct dependency on paging-runtime:3.1.1 and paging-common:3.2.0-alpha02
+--- androidx.paging:paging-runtime:3.1.1 -> 3.2.0-alpha02
| +--- androidx.paging:paging-common:3.2.0-alpha02
Test: n/a
Bug: 235256201
Change-Id: I0eb1f099edc626519fa3468e428313b185d105c9
M paging/paging-runtime/build.gradle
M paging/paging-common/build.gradle
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit 0b7b59589d3722cc2c4491437f6e27fa0a8d1fc8
Author: Clara Fok <clarafok@google.com>
Date: Tue Jul 19 17:52:02 2022
Add project dependency constraint between paging-common and paging-compose
Added bi-directional project constraint between paging-common and paging-compose. This is necessary because recent features added in common and compose requires these two strict matches:
(common:3.2.0-alpha01) with (compose:1.0.0-alpha15) for
(common:3.2.0-alpha02) with (compose:1.0.0-alpha16) for
As such, project constraint is used to ensure that, regardless of which common version is used, the relevant ToT compose will be set as constraint.
Example: Lower compose version with higher common version
Before constraint added, paging-compose:1.0.0-alpha14 with paging-common:3.2.0-alpha01
+--- androidx.paging:paging-compose:1.0.0-alpha14
+--- androidx.paging:paging-common:3.1.0-beta01 -> 3.2.0-alpha01 (*)
After constraint, paging-compose:1.0.0-alpha14 and paging-common:3.2.0-alpha02
+--- androidx.paging:paging-compose:1.0.0-alpha14 -> 1.0.0-alpha16
+--- androidx.paging:paging-common:3.2.0-alpha02 (*)
Example: Higher compose version with lower common version
Before constraint added, paging-compose:1.0.0-alpha16 with paging-common:3.2.0-alpha01
+--- androidx.paging:paging-compose:1.0.0-alpha16
+--- androidx.paging:paging-common:3.2.0-alpha01
After constraint, paging-compose:1.0-0-alpha16 with paging-common:3.2.0-alpha01
+--- androidx.paging:paging-compose:1.0.0-alpha16
+--- androidx.paging:paging-common:3.2.0-alpha01 -> 3.2.0-alpha02
Test: n/a
Fixes: 235256201
Fixes: 239868768
Change-Id: Ifbe86432341d2d4c18fd105b713f454acdaa5b22
M paging/paging-compose/build.gradle
M paging/paging-common/build.gradle
Description
Hi, encountered java.lang.NoSuchMethodError: crash right after upgrading paging compose version to 1.0.0-alpha15
Upon inspecting the source code locally, noticed that the pagingDataDiffer in class LazyPagingItems is calling the PagingDataDiffer new constructor with mainContext as the named argument.
But the PagingDataDiffer class in the lib is having the old constructor argument mainDispatcher
Component used: Paging Compose
Version used: 1.0.0-alpha15
Devices/Android versions reproduced on: All
Build: AI-212.5712.43.2112.8609683, 202205181650,
AI-212.5712.43.2112.8609683, JRE 11.0.12+0-b1504.28-7817840x64 JetBrains s.r.o., OS Mac OS X(x86_64) v12.4, screens 2880.0x1800.0, 1920.0x1080.0; Retina
AS: Chipmunk | 2021.2.1 Patch 1; Kotlin plugin: 212-1.6.21-release-334-AS5457.46; Android Gradle Plugin: 7.2.1; Gradle: 7.4.1; Gradle JDK: version 11.0.12; NDK: from local.properties: (not specified), latest from SDK: (not found); LLDB: pinned revision 3.1 not found, latest from SDK: (package not found); CMake: from local.properties: (not specified), latest from SDK: 3.18.1-g262b901, from PATH: (not found)
IMPORTANT: Please readhttps://developer.android.com/studio/report-bugs.html carefully and supply all required information.