Status Update
Comments
al...@google.com <al...@google.com> #2
I have updated androidx.room:room-paging 2.5.0-alpha02 and androidx-paging to 3.2.0-alpha01 respectively but seems the cause is androidx.room:room-paging is adding the transitive dependency for paging-common 3.1.1.
[33m| +--- [39mandroidx.room:room-paging:2.5.0-alpha02
[33m| | +--- [39mandroidx.paging:paging-common:3.1.1
The lib or some lib has marked paging-common to be strictly 3.1.1 instead of 3.2.0-alpha02.
androidx.paging:paging-common:{strictly 3.1.1} -> 3.1.1
This caused the app to be always using paging-common 3.1.1 which PagingDataDiffer class does not have the updated constructor yet.
kf...@gmail.com <kf...@gmail.com> #3
Please include a sample project that reproduces your issue. None of the room-paging
artifacts have any strict dependencies on Paging.
su...@google.com <su...@google.com> #4
There shouldn't be a strict version requirement, room-paging depending on paging-common:3.1.1 should be able to get upgraded to 3.2.0-alpha01.
By any chance are you hitting this while running an instrumented test? The version of paging should resolve the same between for both the main apk and test apk, but the way this is exposed is unfortunately as a version requirement.
Otherwise, if you can share your build.gradle
it would help us reproduce the issue, it's possible we're missing a version constraint that could better guide how Gradle resolves the paging-common version.
kf...@gmail.com <kf...@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.
su...@google.com <su...@google.com>
al...@google.com <al...@google.com>
ap...@google.com <ap...@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.
na...@google.com <na...@google.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.
Description
Version used: 1.12.0
Devices/Android versions reproduced on: N/A
As described below:
"To check whether the permission is granted to your app, call canScheduleExactAlarms() before trying to set an exact alarm."
However, the API canScheduleExactAlarms() was added to AlarmManager in API level 31 so it would be very useful to add it to AlarmManagerCompat for backward compatibility.